netrc: avoid NULL deref on weird input

A dynbuf that never gets populated might return a NULL, and Coverity
could find a way through like that.

Closes #17275
This commit is contained in:
Daniel Stenberg 2025-05-07 16:36:08 +02:00
parent 412d3c3dc9
commit 613436dbbb
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -247,7 +247,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
} }
break; break;
case MACDEF: case MACDEF:
if(!*tok) if(!tok || !*tok)
state = NOTHING; state = NOTHING;
break; break;
case HOSTFOUND: case HOSTFOUND: