diff options
author | Pablo Barciela <[email protected]> | 2019-03-09 21:45:50 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2019-04-03 11:24:23 +0200 |
commit | 312394dfa42c07a3afa5089c6e3e5b9a1c1001ae (patch) | |
tree | 310a01ef890e6e6fa1f9586f98413949ed5c9bd2 /eel | |
parent | 3641bd709a12f0e75cee6edaa90881420d54455b (diff) | |
download | caja-312394dfa42c07a3afa5089c6e3e5b9a1c1001ae.tar.bz2 caja-312394dfa42c07a3afa5089c6e3e5b9a1c1001ae.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);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Diffstat (limited to 'eel')
-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 c44706c1..c71aadb7 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); |