Fix buffer overrun: if LABEL_STARTER is seen but LABEL_TERMINATOR is not, the
authorDavid Given <dg@cowlark.com>
Sun, 13 Nov 2016 13:04:58 +0000 (14:04 +0100)
committerDavid Given <dg@cowlark.com>
Sun, 13 Nov 2016 13:04:58 +0000 (14:04 +0100)
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

index 178dd45..5d57fa1 100644 (file)
@@ -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);