]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
netrc: avoid NULL deref on weird input
authorDaniel Stenberg <daniel@haxx.se>
Wed, 7 May 2025 14:36:08 +0000 (16:36 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 May 2025 15:15:39 +0000 (17:15 +0200)
A dynbuf that never gets populated might return a NULL, and Coverity
could find a way through like that.

Closes #17275

lib/netrc.c

index 5de3286385de0d611b80ec99ef03081ac081c49d..4afd2a08461c4941c198e0001226fa20139ad6bb 100644 (file)
@@ -247,7 +247,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
         }
         break;
       case MACDEF:
-        if(!*tok)
+        if(!tok || !*tok)
           state = NOTHING;
         break;
       case HOSTFOUND: