summaryrefslogtreecommitdiff
path: root/usr.bin/make/str.c
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2019-12-01 23:53:49 +0000
committerrillig <rillig@NetBSD.org>2019-12-01 23:53:49 +0000
commitffef021d1f5a06292bb4a0bee640927947bda2bf (patch)
tree9cabd63908125fa97d30e950bbd2462db9c21ca4 /usr.bin/make/str.c
parent612ab2af8837c1f36b274d3d812be1143a278c61 (diff)
Fix out-of-bounds read in Str_Match.
Diffstat (limited to 'usr.bin/make/str.c')
-rw-r--r--usr.bin/make/str.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index b5255bc9c70..60f9ad3e34d 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $ */
+/* $NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $");
+__RCSID("$NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -407,6 +407,8 @@ Str_Match(const char *string, const char *pattern)
return 0;
while ((*pattern != ']') && (*pattern != 0))
++pattern;
+ if (*pattern == 0)
+ --pattern;
goto thisCharOK;
}
/*