aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_fnmatch.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-10-25 23:53:30 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-10-26 13:37:45 +0200
commitf0364f7e3191c930008de0736ae00ef28d42bd91 (patch)
tree124961f0cd32f9b27773551c4fb6dcb3fa08d22f /lib/curl_fnmatch.c
parent7b11c5dbe612e152e4ee1b61bac872a7e7958578 (diff)
curl_fnmatch: return error on illegal wildcard pattern
... instead of doing an infinite loop! Added test 1162 to verify. Reported-by: Max Dymond Fixes #2015 Closes #2017
Diffstat (limited to 'lib/curl_fnmatch.c')
-rw-r--r--lib/curl_fnmatch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index 631268bc1..5a6f137c8 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -240,10 +240,10 @@ static int setcharset(unsigned char **p, unsigned char *charset)
if(!ISPRINT(c))
return SETCHARSET_FAIL;
}
- if(c == ']') {
+ else if(c == ']') {
return SETCHARSET_OK;
}
- if(c == '\\') {
+ else if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
@@ -253,7 +253,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else
return SETCHARSET_FAIL;
}
- if(c >= rangestart) {
+ else if(c >= rangestart) {
if((ISLOWER(c) && ISLOWER(rangestart)) ||
(ISDIGIT(c) && ISDIGIT(rangestart)) ||
(ISUPPER(c) && ISUPPER(rangestart))) {
@@ -267,6 +267,8 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else
return SETCHARSET_FAIL;
}
+ else
+ return SETCHARSET_FAIL;
break;
case CURLFNM_SCHS_RIGHTBR:
if(c == '[') {