summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2022-05-07 17:25:28 +0000
committerrillig <rillig@NetBSD.org>2022-05-07 17:25:28 +0000
commitc4192bec8245e8ce280bb74eca8820dca4e9574c (patch)
tree074d01467c4f8029fb2517eca8e52dc1d541a41e /usr.bin/make/parse.c
parentde2803f0b50d1cd177e69e2e2b166811c3a331e6 (diff)
make: fix off-by-one error in buffer for .WAIT nodes
Strangely, GCC didn't warn about this error. For the buffer overflow to actually happen, there would have to be a billion .WAIT nodes.
Diffstat (limited to 'usr.bin/make/parse.c')
-rw-r--r--usr.bin/make/parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index cea4e7df413..cd0c1003d30 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.670 2022/04/18 16:09:05 sjg Exp $ */
+/* $NetBSD: parse.c,v 1.671 2022/05/07 17:25:28 rillig 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.670 2022/04/18 16:09:05 sjg Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.671 2022/05/07 17:25:28 rillig Exp $");
/*
* A file being read.
@@ -699,11 +699,11 @@ static void
ApplyDependencySourceWait(bool isSpecial)
{
static unsigned wait_number = 0;
- char wait_src[16];
+ char name[6 + 10 + 1];
GNode *gn;
- snprintf(wait_src, sizeof wait_src, ".WAIT_%u", ++wait_number);
- gn = Targ_NewInternalNode(wait_src);
+ snprintf(name, sizeof name, ".WAIT_%u", ++wait_number);
+ gn = Targ_NewInternalNode(name);
if (doing_depend)
RememberLocation(gn);
gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN;