altsvc: make the save function ignore NULL filenames

It might happen in OOM situations. Detected bv torture tests.

Closes #4707
This commit is contained in:
Daniel Stenberg 2019-12-12 10:48:57 +01:00
parent 70a6541515
commit 5dc56eb95d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 2 additions and 2 deletions

View 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)