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 unnecessary length limitation for ...



details:   https://anonhg.NetBSD.org/src/rev/2783a11204b0
branches:  trunk
changeset: 938987:2783a11204b0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 22 19:51:19 2020 +0000

description:
make(1): fix unnecessary length limitation for -v option

diffstat:

 usr.bin/make/main.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (35 lines):

diff -r dcd367c115a2 -r 2783a11204b0 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Sep 22 19:41:09 2020 +0000
+++ b/usr.bin/make/main.c       Tue Sep 22 19:51:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #endif
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
  The Regents of the University of California.  All rights reserved.");
@@ -867,13 +867,9 @@
                if (strchr(var, '$')) {
                        value = p1 = Var_Subst(var, VAR_GLOBAL, VARE_WANTRES);
                } else if (expandVars) {
-                       char tmp[128];
-                       int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
-
-                       if (len >= (int)sizeof(tmp))
-                               Fatal("%s: variable name too big: %s",
-                                   progname, var);
-                       value = p1 = Var_Subst(tmp, VAR_GLOBAL, VARE_WANTRES);
+                       char *expr = str_concat3("${", var, "}");
+                       value = p1 = Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES);
+                       free(expr);
                } else {
                        value = Var_Value(var, VAR_GLOBAL, &p1);
                }



Home | Main Index | Thread Index | Old Index