mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-17 22:49:55 +00:00
Add check for return value of hex2val
This commit is contained in:
@@ -69,7 +69,7 @@ hex2bin(const char *hex, uint8_t *bin, size_t bin_len)
|
|||||||
|
|
||||||
while (*hex && len < bin_len) {
|
while (*hex && len < bin_len) {
|
||||||
rc = hex2val(*hex++, &tmp_val);
|
rc = hex2val(*hex++, &tmp_val);
|
||||||
if (rc < 0) {
|
if (rc != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ hex2bin(const char *hex, uint8_t *bin, size_t bin_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = hex2val(*hex++, &tmp_val);
|
rc = hex2val(*hex++, &tmp_val);
|
||||||
if (rc < 0) {
|
if (rc != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
bin[len++] |= tmp_val;
|
bin[len++] |= tmp_val;
|
||||||
|
|||||||
Reference in New Issue
Block a user