Merge pull request #630 from DrDoof/fix/atoi-hex-bounds

cmd_parser: stop atoi_hex() at eight digits and at non-hex characters
This commit is contained in:
logicog authored and GitHub committed 2026-10-16 17:20:28 +02:00
commit 6194356f66
1 file changed
+6 -1
+6 -1
View File
@@ -166,10 +166,15 @@ uint8_t atoi_hex(uint8_t idx)
break;
}
if (h_idx == 8) {
h_idx = 0;
break;
}
// swap hex nibbles
val = (val >> 4) | (val << 4);
if (c - '0' < 10) {
if ((uint8_t)(c - '0') < 10) {
val |= c - '0';
} else {
c |= 0x20;