Fix buffer overrun: if LABEL_STARTER is seen but LABEL_TERMINATOR is not, the

label parser will keep going forever looking for the end of the label. It now
stops at the end of the string.
This commit is contained in:
David Given 2016-11-13 14:04:58 +01:00
parent 6a4f465f53
commit e7132183fb

View file

@ -330,7 +330,7 @@ labeldef(ip)
int oplen; int oplen;
p = ip->rest_line; p = ip->rest_line;
while( *p != LABEL_TERMINATOR) p++; while(*p && (*p != LABEL_TERMINATOR)) p++;
oplen = p - ip->rest_line; oplen = p - ip->rest_line;
if (oplen == 0 || oplen > MAXOPLEN) return; if (oplen == 0 || oplen > MAXOPLEN) return;
strncpy(ip->op[0],ip->rest_line,oplen); strncpy(ip->op[0],ip->rest_line,oplen);