summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2017-05-30 21:58:53 +0000
committerasomers <asomers@FreeBSD.org>2017-05-30 21:58:53 +0000
commitfe7db465cf51455c45eb1cc959074452fcb769ee (patch)
tree5742a211f85eecdcbe6d870fee472ceb69c460bd /usr.bin
parent5389fea22fde348efc5195a1311aa4ff9fa22e9b (diff)
downloadFreeBSD-src-fe7db465cf51455c45eb1cc959074452fcb769ee.zip
FreeBSD-src-fe7db465cf51455c45eb1cc959074452fcb769ee.tar.gz
MFC r316500 (except the part to usr.bin/fortune)
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
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/banner/banner.c4
-rw-r--r--usr.bin/limits/limits.c2
-rw-r--r--usr.bin/rpcinfo/rpcinfo.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/banner/banner.c b/usr.bin/banner/banner.c
index b363f72..0812aed 100644
--- a/usr.bin/banner/banner.c
+++ b/usr.bin/banner/banner.c
@@ -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 {
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 3c5fd6d..af4a4ed 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -549,7 +549,7 @@ print_limit(rlim_t limit, unsigned divisor, const char * inf, const char * pfx,
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);
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
index 884f80d..6524df4 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -854,9 +854,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);
OpenPOWER on IntegriCloud