]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: avoid derefencing a possible NULL pointer
authorDaniel Stenberg <daniel@haxx.se>
Sat, 8 Sep 2018 20:57:36 +0000 (22:57 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 8 Sep 2018 20:57:36 +0000 (22:57 +0200)
Coverity CID 1439134

lib/urlapi.c

index 8287861f783c95c5a22c22271173c385f8cbf6b1..3183598e2de0948f0da566d7ce29d5e5345dbf78 100644 (file)
@@ -438,10 +438,10 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
   *hostname = ++ptr;
 
   /* We could use the login information in the URL so extract it. Only parse
-     options if the handler says we should. */
+     options if the handler says we should. Note that 'h' might be NULL! */
   ccode = Curl_parse_login_details(login, ptr - login - 1,
                                    &userp, &passwdp,
-                                   h->flags & PROTOPT_URLOPTIONS ?
+                                   (h && (h->flags & PROTOPT_URLOPTIONS)) ?
                                    &optionsp:NULL);
   if(ccode) {
     result = CURLUE_MALFORMED_INPUT;