From 17fac79462ef5eacfffbfda4f36d0a4e47e22854 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Thu, 13 Apr 2017 23:22:18 +0000 Subject: [PATCH] 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. Reported by: Coverity (CWE-120) CID: 1006703 Sponsored by: Dell EMC Isilon --- 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 57b5c6a69c85..9531dd715759 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);