diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-14 13:57:54 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-14 13:57:54 -0500 |
commit | fafbb0d61aa5645dfb47058079f3173d420dc13e (patch) | |
tree | 84735a9af569c774b2d758d033229a1fce339ca4 /src/strings.c | |
parent | 81b0b397f59e5f06067add712ba9905db6209b8f (diff) | |
download | spmc-fafbb0d61aa5645dfb47058079f3173d420dc13e.tar.gz |
split() returns NULL if input string is NULL
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 3 |
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); |