Module Name: src
Committed By: sjg
Date: Sat Feb 5 00:37:19 UTC 2022
Modified Files:
src/usr.bin/make: parse.c
Log Message:
Ensure Parse_IsVar does not step off the end of input string.
To generate a diff of this commit:
cvs rdiff -u -r1.661 -r1.662 src/usr.bin/make/parse.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.661 src/usr.bin/make/parse.c:1.662
--- src/usr.bin/make/parse.c:1.661 Fri Feb 4 23:22:19 2022
+++ src/usr.bin/make/parse.c Sat Feb 5 00:37:19 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.661 2022/02/04 23:22:19 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.662 2022/02/05 00:37:19 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.661 2022/02/04 23:22:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.662 2022/02/05 00:37:19 sjg Exp $");
/*
* A file being read.
@@ -1574,6 +1574,8 @@ Parse_IsVar(const char *p, VarAssign *ou
while (ch == ' ' || ch == '\t')
ch = *p++;
+ if (ch == '\0')
+ return false;
#ifdef SUNSHCMD
if (ch == ':' && p[0] == 's' && p[1] == 'h') {
p += 2;