mirror of
https://github.com/opnsense/src.git
synced 2026-06-03 22:02:58 -04: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
1 changed files with 2 additions and 3 deletions
|
|
@ -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