better handle user input in hex_string_to_hex_value

Adapt calling sites too.

When data comes from the user, it is good to check that
what we read is correct and warn the user if it's not.
This commit is contained in:
Cedric Roux
2017-02-02 16:35:45 +01:00
parent 163c37a5a3
commit ea6fb5c481
3 changed files with 36 additions and 13 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
// Converts an hexadecimal ASCII coded digit into its value. **
uint8_t hex_char_to_hex_value (char c);
int hex_char_to_hex_value (char c);
// Converts an hexadecimal ASCII coded string into its value.**
void hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
char *itoa(int i);