svn commit: r330643 - stable/11/usr.bin/banner
Eitan Adler
eadler at FreeBSD.org
Thu Mar 8 08:04:33 UTC 2018
Author: eadler
Date: Thu Mar 8 08:04:32 2018
New Revision: 330643
URL: https://svnweb.freebsd.org/changeset/base/330643
Log:
MFC r316797:
banner(6): Squash a harmless coverity warning
The destination buffer is sized as the sum of program argument lengths, so
it has plenty of room for *argv. Appease Coverity by using strlcpy instead
of strcpy. Similar to a nearby cleanup performed in r316500.
No functional change.
Modified:
stable/11/usr.bin/banner/banner.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.bin/banner/banner.c
==============================================================================
--- stable/11/usr.bin/banner/banner.c Thu Mar 8 08:02:51 2018 (r330642)
+++ stable/11/usr.bin/banner/banner.c Thu Mar 8 08:04:32 2018 (r330643)
@@ -1062,7 +1062,7 @@ main(int argc, char *argv[])
j += strlen(argv[i]) + 1;
if ((message = malloc((size_t)j)) == NULL)
err(1, "malloc");
- strcpy(message, *argv);
+ strlcpy(message, *argv, j);
while (*++argv) {
strlcat(message, " ", j);
strlcat(message, *argv, j);
More information about the svn-src-stable-11
mailing list