From: David Given Date: Sun, 13 Nov 2016 13:04:58 +0000 (+0100) Subject: Fix buffer overrun: if LABEL_STARTER is seen but LABEL_TERMINATOR is not, the X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e7132183fb97c8012f15b580ae2d8848761c1efb;p=ack.git 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. --- diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index 178dd450e..5d57fa1de 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -330,7 +330,7 @@ labeldef(ip) int oplen; p = ip->rest_line; - while( *p != LABEL_TERMINATOR) p++; + while(*p && (*p != LABEL_TERMINATOR)) p++; oplen = p - ip->rest_line; if (oplen == 0 || oplen > MAXOPLEN) return; strncpy(ip->op[0],ip->rest_line,oplen);