[Fix] Add NULL check before using strtok_r 18/186818/1
authorMayank Haarit <mayank.h@samsung.com>
Tue, 14 Aug 2018 15:24:54 +0000 (20:54 +0530)
committerMayank Haarit <mayank.h@samsung.com>
Tue, 14 Aug 2018 15:24:54 +0000 (20:54 +0530)
This patch adds NULL check before using strtok_r()
at first time.

Change-Id: I52e4d3603ad85b93c85e6f03abe65155a3668e91
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
src/inm-net-access.c

index 3abc45354f9ef0fa69bdd14f5681b6dd3b99da51..183217ebad44c036d560576a9ce915dd086c5d0e 100644 (file)
@@ -174,6 +174,9 @@ static inline void __get_redirect_urls(char *temp)
        char * location = NULL;
        int location_str_len = strlen(HTTP_STR_LOCATION);
 
+       if (temp == NULL)
+               return;
+
        location = strtok_r(temp, "\r", &saveptr);
        if (!location)
                return;