ALTAIR: Avoid potential buffer overrun while parsing opcodes and arguments
This commit is contained in:
parent
d4a79a27b0
commit
c2c1f04e8a
1 changed files with 3 additions and 3 deletions
|
@ -252,9 +252,9 @@ if ((sw & SWMASK ('C')) || ((*cptr == '"') && cptr++)) { /* ASCII string? */
|
||||||
or numeric (including spaces).
|
or numeric (including spaces).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (i < sizeof (gbuf)) {
|
while (i < sizeof (gbuf) - 3) {
|
||||||
if (*cptr == ',' || *cptr == '\0' ||
|
if (*cptr == ',' || *cptr == '\0' ||
|
||||||
isdigit(*cptr))
|
sim_isdigit(*cptr))
|
||||||
break;
|
break;
|
||||||
gbuf[i] = toupper(*cptr);
|
gbuf[i] = toupper(*cptr);
|
||||||
cptr++;
|
cptr++;
|
||||||
|
@ -294,7 +294,7 @@ for (j = 0; j < 256; j++) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j > 255) /* not found */
|
if (j > 255) /* not found */
|
||||||
return SCPE_ARG;
|
return sim_messagef (SCPE_ARG, "No such opcode: %s\n", gbuf);
|
||||||
|
|
||||||
val[0] = j; /* store opcode */
|
val[0] = j; /* store opcode */
|
||||||
if (oplen[j] < 2) /* if 1-byter we are done */
|
if (oplen[j] < 2) /* if 1-byter we are done */
|
||||||
|
|
Loading…
Add table
Reference in a new issue