summaryrefslogtreecommitdiff
path: root/lib/curl_fnmatch.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2018-01-29 13:01:43 +0100
committerPatrick Monnerat <patrick@monnerat.net>2018-01-31 01:17:35 +0100
commit19abad095caafb2279f8aeb5d39cd038dcece938 (patch)
treec4ebd985b289d26379cf0a58c129a65a44d2d156 /lib/curl_fnmatch.c
parent2b50e56343e1ac805f10ca17935716b5c70c44b1 (diff)
downloadcurl-19abad095caafb2279f8aeb5d39cd038dcece938.tar.gz
fnmatch: do not match the empty string with a character set
Diffstat (limited to 'lib/curl_fnmatch.c')
-rw-r--r--lib/curl_fnmatch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index f33bba1f1..5b6d28c06 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -352,6 +352,8 @@ static int loop(const unsigned char *pattern, const unsigned char *string,
unsigned char *pp = p + 1; /* cannot handle with pointer to register */
if(setcharset(&pp, charset)) {
int found = FALSE;
+ if(!*s)
+ return CURL_FNMATCH_NOMATCH;
if(charset[(unsigned int)*s])
found = TRUE;
else if(charset[CURLFNM_ALNUM])
@@ -380,9 +382,7 @@ static int loop(const unsigned char *pattern, const unsigned char *string,
if(found) {
p = pp + 1;
- if(*s)
- /* don't advance if we're matching on an empty string */
- s++;
+ s++;
memset(charset, 0, CURLFNM_CHSET_SIZE);
}
else