curl: fix segmentation fault for empty output file names.

Function glob_match_url set *result to NULL when called with filename =
"", producing an indirect NULL pointer dereference.

Closes #8606
This commit is contained in:
Ian Blanes 2022-03-28 09:39:09 +02:00 committed by Daniel Stenberg
parent a6c3b7d6f5
commit 9e5bd9ba19
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 13 additions and 1 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -686,6 +686,9 @@ CURLcode glob_match_url(char **result, char *filename, struct URLGlob *glob)
return CURLE_OUT_OF_MEMORY;
}
if(curlx_dyn_addn(&dyn, "", 0))
return CURLE_OUT_OF_MEMORY;
#if defined(MSDOS) || defined(WIN32)
{
char *sanitized;