diff options
author | Pablo Barciela <[email protected]> | 2019-03-09 21:45:50 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-19 23:15:21 +0200 |
commit | 0fba10298673a68ccad3f4fd85070d4253e0b4e0 (patch) | |
tree | 2e87ac7c8e856e592efdca85fe6a7954c490f9dc | |
parent | f0b9aba4e74f5b15031202af6e1e720c7db3c8ab (diff) | |
download | caja-0fba10298673a68ccad3f4fd85070d4253e0b4e0.tar.bz2 caja-0fba10298673a68ccad3f4fd85070d4253e0b4e0.tar.xz |
eel-string: avoid 'memcpy' with NULL argument
Fixes Clang static analyzer warning:
eel-string.c:325:9: warning: Null pointer passed as an argument to a 'nonnull' parameter
memcpy (result_position, replacement, replacement_length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rw-r--r-- | eel/eel-string.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/eel/eel-string.c b/eel/eel-string.c index aea801ea..3ed54d89 100644 --- a/eel/eel-string.c +++ b/eel/eel-string.c @@ -292,6 +292,10 @@ eel_str_replace_substring (const char *string, { return NULL; } + else if (replacement == NULL) + { + return (char *) string; + } substring_length = strlen (substring); replacement_length = eel_strlen (replacement); |