Module Name:    src
Committed By:   christos
Date:           Sun Jun  5 01:39:17 UTC 2016

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

Log Message:
NUL terminate.


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.246 src/usr.bin/make/main.c:1.247
--- src/usr.bin/make/main.c:1.246	Sat Jun  4 20:48:58 2016
+++ src/usr.bin/make/main.c	Sat Jun  4 21:39:17 2016
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #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 @@ cached_realpath(const char *pathname, ch
     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))) {

Reply via email to