Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): fix off-by-one error in Var_Parse for ...
details: https://anonhg.NetBSD.org/src/rev/dd6baa82fd11
branches: trunk
changeset: 936439:dd6baa82fd11
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 26 22:19:11 2020 +0000
description:
make(1): fix off-by-one error in Var_Parse for dynamic variables
diffstat:
usr.bin/make/unit-tests/varparse-dynamic.exp | 1 +
usr.bin/make/var.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diffs (63 lines):
diff -r ec1c9b207a5b -r dd6baa82fd11 usr.bin/make/unit-tests/varparse-dynamic.exp
--- a/usr.bin/make/unit-tests/varparse-dynamic.exp Sun Jul 26 22:15:36 2020 +0000
+++ b/usr.bin/make/unit-tests/varparse-dynamic.exp Sun Jul 26 22:19:11 2020 +0000
@@ -1,3 +1,4 @@
+make: "varparse-dynamic.mk" line 8: Malformed conditional (${.TARGEX})
make: "varparse-dynamic.mk" line 10: Malformed conditional (${.TARGXX})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff -r ec1c9b207a5b -r dd6baa82fd11 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Jul 26 22:15:36 2020 +0000
+++ b/usr.bin/make/var.c Sun Jul 26 22:19:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $ */
+/* $NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -136,6 +136,12 @@
#include "job.h"
#include "metachar.h"
+#define VAR_DEBUG(fmt, ...) \
+ if (!DEBUG(VAR)) \
+ (void) 0; \
+ else \
+ fprintf(debug_file, fmt, __VA_ARGS__)
+
/*
* This lets us tell if we have replaced the original environ
* (which we cannot free).
@@ -3561,11 +3567,10 @@
isupper((unsigned char) varname[1]) &&
(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
{
- int len = namelen - 1;
- if ((strncmp(varname, ".TARGET", len) == 0) ||
- (strncmp(varname, ".ARCHIVE", len) == 0) ||
- (strncmp(varname, ".PREFIX", len) == 0) ||
- (strncmp(varname, ".MEMBER", len) == 0))
+ if ((strcmp(varname, ".TARGET") == 0) ||
+ (strcmp(varname, ".ARCHIVE") == 0) ||
+ (strcmp(varname, ".PREFIX") == 0) ||
+ (strcmp(varname, ".MEMBER") == 0))
{
dynamic = TRUE;
}
Home |
Main Index |
Thread Index |
Old Index