If there is no length of the token, assign a blank string to avoid
risking it being NULL.
Pointed out by Coverity
Closes #17351
}
}
- tok = curlx_dyn_ptr(&token);
+ if(curlx_dyn_len(&token))
+ tok = curlx_dyn_ptr(&token);
+ else
+ /* since tok might actually be NULL for no content, set it to blank
+ to avoid having to deal with it being NULL */
+ tok = "";
switch(state) {
case NOTHING:
}
break;
case MACDEF:
- if(!tok || !*tok)
+ if(!*tok)
state = NOTHING;
break;
case HOSTFOUND:
else {
our_login = TRUE;
free(login);
- login = strdup(tok ? tok : "");
+ login = strdup(tok);
if(!login) {
retcode = NETRC_OUT_OF_MEMORY; /* allocation failed */
goto out;