Avoid coredump for

(FOO) = fu

reported by Ori Bernstein
This commit is contained in:
sjg 2016-12-09 22:56:21 +00:00
parent 14bff6ac28
commit f65fa017b9
1 changed files with 4 additions and 4 deletions

View File

@ -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;