Module Name:    src
Committed By:   rillig
Date:           Sat Apr 27 21:26:23 UTC 2024

Modified Files:
        src/usr.bin/make: var.c

Log Message:
make: fix comment about forcing a use-after-free

The previous expression didn't cause any bug, as the modifier
':@VAR@loop@' changed the value of the expression, thus making the
expression independent from the variable value.

Instead, the variable needs to be deleted from within an indirect
modifier, and that modifier needs to evaluate to an empty string, thus
doing nothing and preserving the original expression value.


To generate a diff of this commit:
cvs rdiff -u -r1.1106 -r1.1107 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.1106 src/usr.bin/make/var.c:1.1107
--- src/usr.bin/make/var.c:1.1106	Sat Apr 27 20:41:32 2024
+++ src/usr.bin/make/var.c	Sat Apr 27 21:26:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4542,7 +4542,7 @@ Var_Parse(const char **pp, GNode *scope,
 	 * while its value is still being used:
 	 *
 	 *	VAR=	value
-	 *	_:=	${VAR:${:U@VAR@loop@}:S,^,prefix,}
+	 *	_:=	${VAR:${:U:@VAR@@}:S,^,prefix,}
 	 *
 	 * The same effect might be achievable using the '::=' or the ':_'
 	 * modifiers.

Reply via email to