From 65d326d307a0b8b0d0ad22afddd608888d6bb5d8 Mon Sep 17 00:00:00 2001 From: eadler Date: Thu, 8 Mar 2018 08:04:32 +0000 Subject: [PATCH] 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. --- usr.bin/banner/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/banner/banner.c b/usr.bin/banner/banner.c index 0812aed380d..a968c7f5ebc 100644 --- a/usr.bin/banner/banner.c +++ b/usr.bin/banner/banner.c @@ -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); -- 2.45.0