Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make We cannot use buf as both src and destination f...



details:   https://anonhg.NetBSD.org/src/rev/babaa6401798
branches:  trunk
changeset: 823320:babaa6401798
user:      sjg <sjg%NetBSD.org@localhost>
date:      Wed Apr 19 04:54:17 2017 +0000

description:
We cannot use buf as both src and destination for snprintf.

diffstat:

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

diffs (40 lines):

diff -r c456b186b2d1 -r babaa6401798 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Apr 19 03:43:34 2017 +0000
+++ b/usr.bin/make/main.c       Wed Apr 19 04:54:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.262 2017/04/16 20:14:49 riastradh Exp $     */
+/*     $NetBSD: main.c,v 1.263 2017/04/19 04:54:17 sjg Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.262 2017/04/16 20:14:49 riastradh Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.263 2017/04/19 04:54:17 sjg 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.262 2017/04/16 20:14:49 riastradh Exp $");
+__RCSID("$NetBSD: main.c,v 1.263 2017/04/19 04:54:17 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -702,8 +702,10 @@
        va_end(ap);
 
        if (path[0] != '/') {
-               snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path);
-               path = buf;
+               char buf2[MAXPATHLEN + 1];
+               
+               snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path);
+               path = buf2;
        }
 
        /* look for the directory and try to chdir there */



Home | Main Index | Thread Index | Old Index