Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make NUL terminate.



details:   https://anonhg.NetBSD.org/src/rev/d15c192e6cc4
branches:  trunk
changeset: 345681:d15c192e6cc4
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 05 01:39:17 2016 +0000

description:
NUL terminate.

diffstat:

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

diffs (44 lines):

diff -r e8d78eb8c8f0 -r d15c192e6cc4 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Jun 05 01:31:03 2016 +0000
+++ b/usr.bin/make/main.c       Sun Jun 05 01:39:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.246 2016/06/05 00:48:58 sjg Exp $   */
+/*     $NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.246 2016/06/05 00:48:58 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.246 2016/06/05 00:48:58 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1872,13 +1872,14 @@
     rp = Var_Value(pathname, cache, &cp);
     if (rp) {
        /* a hit */
-       if (resolved)
+       if (resolved) {
 #if defined(MAKE_NATIVE) || defined(HAVE_STRLCPY)
            strlcpy(resolved, rp, MAXPATHLEN);
 #else
            strncpy(resolved, rp, MAXPATHLEN);
+           resolved[MAXPATHLEN - 1] = '\0';
 #endif
-       else
+       } else
            resolved = bmake_strdup(rp);
     } else {
        if ((rp = realpath(pathname, resolved))) {



Home | Main Index | Thread Index | Old Index