svn commit: r317438 - in stable/11/usr.bin: banner fortune/strfile limits rpcinfo
Alan Somers
asomers at FreeBSD.org
Wed Apr 26 14:43:23 UTC 2017
Author: asomers
Date: Wed Apr 26 14:43:21 2017
New Revision: 317438
URL: https://svnweb.freebsd.org/changeset/base/317438
Log:
MFC r316500:
strcpy => strlcpy, strcat => strlcat
Reported by: Coverity
CID: 1006703 978863 1006745 1347163
Reviewed by: cem
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10192
Modified:
stable/11/usr.bin/banner/banner.c
stable/11/usr.bin/fortune/strfile/strfile.c
stable/11/usr.bin/limits/limits.c
stable/11/usr.bin/rpcinfo/rpcinfo.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.bin/banner/banner.c
==============================================================================
--- stable/11/usr.bin/banner/banner.c Wed Apr 26 14:28:27 2017 (r317437)
+++ stable/11/usr.bin/banner/banner.c Wed Apr 26 14:43:21 2017 (r317438)
@@ -1064,8 +1064,8 @@ main(int argc, char *argv[])
err(1, "malloc");
strcpy(message, *argv);
while (*++argv) {
- strcat(message, " ");
- strcat(message, *argv);
+ strlcat(message, " ", j);
+ strlcat(message, *argv, j);
}
nchars = strlen(message);
} else {
Modified: stable/11/usr.bin/fortune/strfile/strfile.c
==============================================================================
--- stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:28:27 2017 (r317437)
+++ stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:43:21 2017 (r317438)
@@ -303,8 +303,8 @@ getargs(int argc, char **argv)
usage();
}
if (*Outfile == '\0') {
- strcpy(Outfile, Infile);
- strcat(Outfile, ".dat");
+ strlcpy(Outfile, Infile, sizeof(Outfile));
+ strlcat(Outfile, ".dat", sizeof(Outfile));
}
}
Modified: stable/11/usr.bin/limits/limits.c
==============================================================================
--- stable/11/usr.bin/limits/limits.c Wed Apr 26 14:28:27 2017 (r317437)
+++ stable/11/usr.bin/limits/limits.c Wed Apr 26 14:43:21 2017 (r317438)
@@ -561,7 +561,7 @@ print_limit(rlim_t limit, unsigned divis
char numbr[64];
if (limit == RLIM_INFINITY)
- strcpy(numbr, inf);
+ strlcpy(numbr, inf, sizeof(numbr));
else
sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor));
printf(pfx, which, numbr);
Modified: stable/11/usr.bin/rpcinfo/rpcinfo.c
==============================================================================
--- stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:28:27 2017 (r317437)
+++ stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:43:21 2017 (r317438)
@@ -856,9 +856,9 @@ failed:
printf("%-10s", buf);
buf[0] = '\0';
for (nl = rs->nlist; nl; nl = nl->next) {
- strcat(buf, nl->netid);
+ strlcat(buf, nl->netid, sizeof(buf));
if (nl->next)
- strcat(buf, ",");
+ strlcat(buf, ",", sizeof(buf));
}
printf("%-32s", buf);
rpc = getrpcbynumber(rs->prog);
More information about the svn-src-stable-11
mailing list