From fafbb0d61aa5645dfb47058079f3173d420dc13e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 14 Jan 2020 13:57:54 -0500 Subject: split() returns NULL if input string is NULL --- src/strings.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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); -- cgit