From: Daniel Stenberg Date: Sat, 8 Sep 2018 20:57:36 +0000 (+0200) Subject: urlapi: avoid derefencing a possible NULL pointer X-Git-Tag: curl-7_62_0~208 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=01dedc99fc8d386fe955421ab05a1c4094c9190b;p=thirdparty%2Fcurl.git urlapi: avoid derefencing a possible NULL pointer Coverity CID 1439134 --- diff --git a/lib/urlapi.c b/lib/urlapi.c index 8287861f78..3183598e2d 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -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;