From: Daniel Stenberg Date: Thu, 12 Dec 2019 09:48:57 +0000 (+0100) Subject: altsvc: make the save function ignore NULL filenames X-Git-Tag: curl-7_68_0~74 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5dc56eb95d1a5d9ac4c35d1ad038d98731decab2;p=thirdparty%2Fcurl.git altsvc: make the save function ignore NULL filenames It might happen in OOM situations. Detected bv torture tests. Closes #4707 --- diff --git a/lib/altsvc.c b/lib/altsvc.c index 28c9276b1b..bf869c37a5 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -320,8 +320,8 @@ CURLcode Curl_altsvc_save(struct altsvcinfo *altsvc, const char *file) /* no cache activated */ return CURLE_OK; - if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file[0]) - /* marked as read-only or zero length file name */ + if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0]) + /* marked as read-only, no file or zero length file name */ return CURLE_OK; out = fopen(file, FOPEN_WRITETEXT); if(!out)