From cde1cf7166bde68d57a0ddda08b707734adec5b1 Mon Sep 17 00:00:00 2001 From: bluhm Date: Mon, 10 Jul 2017 07:10:29 +0000 Subject: 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@ --- usr.bin/make/varmodifiers.c | 4 ++-- 1 file 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); -- cgit v1.2.3-59-g8ed1b