From: Daniel Stenberg Date: Mon, 12 May 2025 07:21:31 +0000 (+0200) Subject: netrc: avoid strdup NULL X-Git-Tag: curl-8_14_0~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5398fa393a1a4a1f6808262889b7c58ee6c0bec;p=thirdparty%2Fcurl.git netrc: avoid strdup NULL Coverity found a code path where this might happen. Avoid it. Closes #17319 --- diff --git a/lib/netrc.c b/lib/netrc.c index 4afd2a0846..971e4b81de 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -268,7 +268,7 @@ static NETRCcode parsenetrc(struct store_netrc *store, else { our_login = TRUE; free(login); - login = strdup(tok); + login = strdup(tok ? tok : ""); if(!login) { retcode = NETRC_OUT_OF_MEMORY; /* allocation failed */ goto out;