]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
altsvc: make the save function ignore NULL filenames
authorDaniel Stenberg <daniel@haxx.se>
Thu, 12 Dec 2019 09:48:57 +0000 (10:48 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 12 Dec 2019 13:10:09 +0000 (14:10 +0100)
It might happen in OOM situations. Detected bv torture tests.

Closes #4707

lib/altsvc.c

index 28c9276b1b45acebd6c8ffa1b72bd468eabca6d7..bf869c37a5140f5039b079ab1844ba457dd885fa 100644 (file)
@@ -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)