Module Name:    src
Committed By:   rillig
Date:           Sat Dec  5 17:25:42 UTC 2020

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

Log Message:
make(1): refuse to use vsnprintf that is prone to buffer overflows

Several parts of make intentionally depend on the guarantee that
snprintf and vsnprintf do not overflow their buffer.  If an
implementation cannot provide this guarantee, refuse to use it.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/make/util.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/util.c
diff -u src/usr.bin/make/util.c:1.70 src/usr.bin/make/util.c:1.71
--- src/usr.bin/make/util.c:1.70	Mon Nov 23 23:41:11 2020
+++ src/usr.bin/make/util.c	Sat Dec  5 17:25:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.70 2020/11/23 23:41:11 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.71 2020/12/05 17:25:41 rillig Exp $	*/
 
 /*
  * Missing stuff from OS's
@@ -15,7 +15,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: util.c,v 1.70 2020/11/23 23:41:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.71 2020/12/05 17:25:41 rillig Exp $");
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
 extern int errno, sys_nerr;
@@ -378,8 +378,7 @@ vsnprintf(char *s, size_t n, const char 
 	    fakebuf._cnt = 0;
 	return n - fakebuf._cnt - 1;
 #else
-	(void)vsprintf(s, fmt, args);
-	return strlen(s);
+	::: "error: vsnprintf must be available";
 #endif
 }
 

Reply via email to