summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-09 21:45:50 +0100
committerraveit65 <[email protected]>2022-07-19 23:15:21 +0200
commit0fba10298673a68ccad3f4fd85070d4253e0b4e0 (patch)
tree2e87ac7c8e856e592efdca85fe6a7954c490f9dc
parentf0b9aba4e74f5b15031202af6e1e720c7db3c8ab (diff)
downloadcaja-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.c4
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);