aboutsummaryrefslogtreecommitdiff
path: root/src/strings.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2020-01-14 13:57:54 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2020-01-14 13:57:54 -0500
commitfafbb0d61aa5645dfb47058079f3173d420dc13e (patch)
tree84735a9af569c774b2d758d033229a1fce339ca4 /src/strings.c
parent81b0b397f59e5f06067add712ba9905db6209b8f (diff)
downloadspmc-fafbb0d61aa5645dfb47058079f3173d420dc13e.tar.gz
split() returns NULL if input string is NULL
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/strings.c b/src/strings.c
index 95068d0..0dc9c47 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -149,6 +149,9 @@ void strdelsuffix(char *sptr, const char *suffix) {
*/
char** split(char *_sptr, const char* delim)
{
+ if (_sptr == NULL) {
+ return NULL;
+ }
size_t split_alloc = 0;
// Duplicate the input string and save a copy of the pointer to be freed later
char *orig = strdup(_sptr);