curl_fnmatch: only allow two asterisks for matching

The previous limit of 5 can still end up in situation that takes a very
long time and consumes a lot of CPU.

If there is still a rare use case for this, a user can provide their own
fnmatch callback for a version that allows a larger set of wildcards.

This commit was triggered by yet another OSS-Fuzz timeout due to this.
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8369

Closes #2587
This commit is contained in:
Daniel Stenberg 2018-05-18 16:48:13 +02:00
parent 27aebcc1d1
commit 404c8850da
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 3 additions and 7 deletions

View file

@ -355,5 +355,5 @@ int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
return loop((unsigned char *)pattern, (unsigned char *)string, 5);
return loop((unsigned char *)pattern, (unsigned char *)string, 2);
}