mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
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:
1 file changed
+6
-1
+6
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user