aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-09-08 22:57:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-09-08 22:57:36 +0200
commit01dedc99fc8d386fe955421ab05a1c4094c9190b (patch)
tree9afadc94ed507110ba4a4250951d12ee69406a9b
parent82846a456a8e2f904353e5575a1e9e0744a56359 (diff)
urlapi: avoid derefencing a possible NULL pointer
Coverity CID 1439134
-rw-r--r--lib/urlapi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 8287861f7..3183598e2 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;