add error check
This commit is contained in:
parent
2c1209ba63
commit
c440629dbf
|
@ -376,7 +376,10 @@ read_pipe(pic_state *pic, struct pic_port *port, char c)
|
||||||
case 'n': c = '\n'; break;
|
case 'n': c = '\n'; break;
|
||||||
case 'r': c = '\r'; break;
|
case 'r': c = '\r'; break;
|
||||||
case 'x':
|
case 'x':
|
||||||
for(size_t i = 0; (HEX_BUF[i++] = (next(port))) != ';' && i < sizeof HEX_BUF;);
|
for(size_t i = 0; (HEX_BUF[i] = next(port)) != ';'; i++) {
|
||||||
|
if (i >= sizeof HEX_BUF)
|
||||||
|
read_error(pic, "expected ';'");
|
||||||
|
}
|
||||||
c = (char)strtol(HEX_BUF, NULL, 16);
|
c = (char)strtol(HEX_BUF, NULL, 16);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue