Module Name: src Committed By: sjg Date: Wed Apr 19 04:54:17 UTC 2017
Modified Files: src/usr.bin/make: main.c Log Message: We cannot use buf as both src and destination for snprintf. To generate a diff of this commit: cvs rdiff -u -r1.262 -r1.263 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.262 src/usr.bin/make/main.c:1.263 --- src/usr.bin/make/main.c:1.262 Sun Apr 16 20:14:49 2017 +++ src/usr.bin/make/main.c Wed Apr 19 04:54:17 2017 @@ -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 @@ __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.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 @@ Main_SetObjdir(const char *fmt, ...) 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 */