From 62545a12f6e2b0e6317821137a2ed792fe139ef0 Mon Sep 17 00:00:00 2001 From: se Date: Thu, 14 Feb 2019 15:42:29 +0000 Subject: [PATCH] MFC r343480,343482: Silence Clang Scan warning about unsafe use of strcpy. Replace strcpy() by memcpy to the previously allocated range of known size. --- lib/libfigpar/string_m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libfigpar/string_m.c b/lib/libfigpar/string_m.c index d358e90488d..158774143ec 100644 --- a/lib/libfigpar/string_m.c +++ b/lib/libfigpar/string_m.c @@ -120,9 +120,9 @@ replaceall(char *source, const char *find, const char *replace) /* If replace is longer than find, we'll need to create a temp copy */ if (rlen > flen) { temp = malloc(slen + 1); - if (errno != 0) /* could not allocate memory */ + if (temp == NULL) /* could not allocate memory */ return (-1); - strcpy(temp, source); + memcpy(temp, source, slen + 1); } else temp = source; -- 2.45.0