summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-12-12 10:48:57 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-12-12 14:10:09 +0100
commit5dc56eb95d1a5d9ac4c35d1ad038d98731decab2 (patch)
treef1fdc27bc0d7ff1f5df46e6814fcc65907b14192
parent70a654151515a3cd17b47884154b34a857e81db9 (diff)
downloadcurl-5dc56eb95d1a5d9ac4c35d1ad038d98731decab2.tar.gz
altsvc: make the save function ignore NULL filenames
It might happen in OOM situations. Detected bv torture tests. Closes #4707
-rw-r--r--lib/altsvc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/altsvc.c b/lib/altsvc.c
index 28c9276b1..bf869c37a 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)