From e7132183fb97c8012f15b580ae2d8848761c1efb Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 13 Nov 2016 14:04:58 +0100 Subject: [PATCH] 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. --- mach/proto/top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);