FreeCalypso > hg > freecalypso-tools
diff target-utils/simagent/stringarg.c @ 777:0cffc53991f9
simagent: bugfix in hex string arg parsing function
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 Mar 2021 23:58:15 +0000 |
parents | fac3176de18d |
children |
line wrap: on
line diff
--- a/target-utils/simagent/stringarg.c Fri Mar 12 23:36:46 2021 +0000 +++ b/target-utils/simagent/stringarg.c Fri Mar 12 23:58:15 2021 +0000 @@ -30,14 +30,15 @@ break; if (!isxdigit(arg[0]) || !isxdigit(arg[1])) { printf("ERROR: invalid hex string input\n"); - return; + return(-1); } if (count >= maxlen) { printf("ERROR: hex string input is too long\n"); - return; + return(-1); } buf[count++] = (decode_hex_digit(arg[0]) << 4) | decode_hex_digit(arg[1]); + arg += 2; } return count; }