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): refuse to use vsnprintf that is prone ...



details:   https://anonhg.NetBSD.org/src/rev/7822b0b80bd2
branches:  trunk
changeset: 1016864:7822b0b80bd2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 05 17:25:41 2020 +0000

description:
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.

diffstat:

 usr.bin/make/util.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r c56e495bb80f -r 7822b0b80bd2 usr.bin/make/util.c
--- a/usr.bin/make/util.c       Sat Dec 05 17:17:37 2020 +0000
+++ b/usr.bin/make/util.c       Sat Dec 05 17:25:41 2020 +0000
@@ -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 @@
            fakebuf._cnt = 0;
        return n - fakebuf._cnt - 1;
 #else
-       (void)vsprintf(s, fmt, args);
-       return strlen(s);
+       ::: "error: vsnprintf must be available";
 #endif
 }
 



Home | Main Index | Thread Index | Old Index