summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-07-10 07:10:29 +0000
committerbluhm <bluhm@openbsd.org>2017-07-10 07:10:29 +0000
commitcde1cf7166bde68d57a0ddda08b707734adec5b1 (patch)
treed4403c97ae61de0abb8585861a1aa70323141087
parentreplace Fifos with FIFOs. (diff)
downloadwireguard-openbsd-cde1cf7166bde68d57a0ddda08b707734adec5b1.tar.xz
wireguard-openbsd-cde1cf7166bde68d57a0ddda08b707734adec5b1.zip
Also check for NUL termination at the first character of tstr in
the error path of VarModifiers_Apply(). This prevents a sporadic crash in make's regress target t41. OK espie@
-rw-r--r--usr.bin/make/varmodifiers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/make/varmodifiers.c b/usr.bin/make/varmodifiers.c
index ca0622f125f..df642971ef8 100644
--- a/usr.bin/make/varmodifiers.c
+++ b/usr.bin/make/varmodifiers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: varmodifiers.c,v 1.46 2017/02/24 23:38:47 espie Exp $ */
+/* $OpenBSD: varmodifiers.c,v 1.47 2017/07/10 07:10:29 bluhm Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -1517,7 +1517,7 @@ VarModifiers_Apply(char *str, const struct Name *name, SymTable *ctxt,
} else {
Error("Bad modifier: %s", tstr);
/* Try skipping to end of var... */
- for (tstr++; *tstr != endc && *tstr != '\0';)
+ while (*tstr != endc && *tstr != '\0')
tstr++;
if (str != NULL && *freePtr)
free(str);