mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
Silence Clang Scan warning about potentially unsafe use of strcpy.
While this is a false positive, the use of strdup() simplifies the code. MFC after: 2 weeks
This commit is contained in:
parent
71bc4af6ed
commit
4268f3b3e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343480
|
@ -119,10 +119,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 */
|
||||
temp = strdup(source);
|
||||
if (temp == NULL) /* could not allocate memory */
|
||||
return (-1);
|
||||
strcpy(temp, source);
|
||||
} else
|
||||
temp = source;
|
||||
|
||||
|
|
Loading…
Reference in a new issue