urlglob: avoid NULL pointer dereference
authorDaniel Stenberg <daniel@haxx.se>
Fri, 6 Sep 2013 12:12:44 +0000 (14:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Sep 2013 12:12:44 +0000 (14:12 +0200)
Thanks to clang-analyzer

src/tool_urlglob.c

index 1644077f2876ea22fc5497f25ec63d6d433f2d77..7c7bd4b3595dfc1ca1e1ac4f67b4d7e5ba95b8c8 100644 (file)
@@ -287,7 +287,7 @@ static GlobCode glob_range(URLGlob *glob, char **patternp,
         }
         else
           step_n = 1;
-        if(*endp == ']') {
+        if(endp && (*endp == ']')) {
           pattern= endp+1;
         }
         else