Add check for return value of hex2val

This commit is contained in:
Rahul Tank
2024-04-17 18:07:34 +05:30
parent 21cebe56e8
commit cc997ecc33
+2 -2
View File
@@ -69,7 +69,7 @@ hex2bin(const char *hex, uint8_t *bin, size_t bin_len)
while (*hex && len < bin_len) {
rc = hex2val(*hex++, &tmp_val);
if (rc < 0) {
if (rc != 0) {
return 0;
}
@@ -81,7 +81,7 @@ hex2bin(const char *hex, uint8_t *bin, size_t bin_len)
}
rc = hex2val(*hex++, &tmp_val);
if (rc < 0) {
if (rc != 0) {
return 0;
}
bin[len++] |= tmp_val;