Module Name:    src
Committed By:   sjg
Date:           Fri Dec  9 22:56:21 UTC 2016

Modified Files:
        src/usr.bin/make: parse.c

Log Message:
Avoid coredump for

(FOO) = fu

reported by Ori Bernstein


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.216 src/usr.bin/make/parse.c:1.217
--- src/usr.bin/make/parse.c:1.216	Wed Dec  7 15:00:46 2016
+++ src/usr.bin/make/parse.c	Fri Dec  9 22:56:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.216 2016/12/07 15:00:46 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.216 2016/12/07 15:00:46 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.216 2016/12/07 15:00:46 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1851,7 +1851,7 @@ Parse_DoVar(char *line, GNode *ctxt)
      * XXX Rather than counting () and {} we should look for $ and
      * then expand the variable.
      */
-    for (depth = 0, cp = line + 1; depth != 0 || *cp != '='; cp++) {
+    for (depth = 0, cp = line + 1; depth > 0 || *cp != '='; cp++) {
 	if (*cp == '(' || *cp == '{') {
 	    depth++;
 	    continue;

Reply via email to