If string is NULL, then the proceeding strlen() on the string
will lead to a NULL pointer dereference error (segmentation fault).
Fix this by swapping the order of the comparisons, first check for
a NULL pointer; if that's not true then do the strlen check.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
char **o = options;
char *tmp;
- if (!strlen(string) || string == NULL) {
+ if (!string || !strlen(string)) {
*(o++) = NULL;
*(o++) = NULL;
return 0;
char *tmp;
char *p;
- if (!strlen(string) || string == NULL)
+ if (!string || !strlen(string))
return 0;
tmp = strtok(string, ",");
char *tmp;
char *p;
- if (!strlen(string) || string == NULL)
+ if (!string || !strlen(string))
return 0;
tmp = strtok(string, ",");