summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2015-12-22 21:50:54 +0000
committerespie <espie@openbsd.org>2015-12-22 21:50:54 +0000
commit6c3a779b6fa225a47bb901b9a1572be44d689a88 (patch)
treecdb41015e4832e2bc11a251b2a035de6865985d3
parentfix sendmail options parsing (diff)
downloadwireguard-openbsd-6c3a779b6fa225a47bb901b9a1572be44d689a88.tar.xz
wireguard-openbsd-6c3a779b6fa225a47bb901b9a1572be44d689a88.zip
in case we have a parse error, dispell the target list early to avoid
various problems. Problem noticed by jsg@, deeper patch than he suggested okay jsg@ and tb@.
-rw-r--r--usr.bin/make/parse.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 11d02df162a..47d124c19fc 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.114 2015/11/29 09:17:12 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.115 2015/12/22 21:50:54 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -822,12 +822,18 @@ ParseDoDependency(const char *line) /* the line to parse */
Array_Reset(&gsources);
cp = parse_do_targets(&paths, &tOp, line);
- if (cp == NULL || specType == SPECIAL_ERROR)
+ if (cp == NULL || specType == SPECIAL_ERROR) {
+ /* invalidate targets for further processing */
+ Array_Reset(&gtargets);
return;
+ }
op = parse_operator(&cp);
- if (op == OP_ERROR)
+ if (op == OP_ERROR) {
+ /* invalidate targets for further processing */
+ Array_Reset(&gtargets);
return;
+ }
Array_FindP(&gtargets, ParseDoOp, op);
dedup_targets(&gtargets);