diff options
author | will <will@FreeBSD.org> | 2000-11-30 13:56:19 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2000-11-30 13:56:19 +0000 |
commit | 4e7062f7a76f231ee5e81e160fac28829caa7f6a (patch) | |
tree | c3355f0f44b765a51b60d042f361f787b2298e1f /usr.bin/make/util.c | |
parent | 56b0ddae6c97b0d229fa62bc685d8379452c108b (diff) | |
download | FreeBSD-src-4e7062f7a76f231ee5e81e160fac28829caa7f6a.zip FreeBSD-src-4e7062f7a76f231ee5e81e160fac28829caa7f6a.tar.gz |
Format string paranoia. This should avoid potential buffer overflows from
user input (in its ever-broadening definition).
Obtained from: NetBSD
Diffstat (limited to 'usr.bin/make/util.c')
-rw-r--r-- | usr.bin/make/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index 57ab0c0..80197b9 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -217,13 +217,13 @@ getwd(pathname) /* open the parent directory */ if (stat(nextpathptr, &st_dotdot) == -1) { - (void) sprintf(pathname, + snprintf(pathname, sizeof(pathname), "getwd: Cannot stat directory \"%s\" (%s)", nextpathptr, strerror(errno)); return (NULL); } if ((dp = opendir(nextpathptr)) == NULL) { - (void) sprintf(pathname, + snprintf(pathname, sizeof(pathname), "getwd: Cannot open directory \"%s\" (%s)", nextpathptr, strerror(errno)); return (NULL); @@ -246,7 +246,7 @@ getwd(pathname) continue; (void) strcpy(cur_name_add, d->d_name); if (lstat(nextpathptr, &st_next) == -1) { - (void) sprintf(pathname, "getwd: Cannot stat \"%s\" (%s)", + snprintf(pathname, sizeof(pathname), "getwd: Cannot stat \"%s\" (%s)", d->d_name, strerror(errno)); (void) closedir(dp); return (NULL); |