[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 46/163: fnmatch: insist on escaped bracket to match
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 46/163: fnmatch: insist on escaped bracket to match |
Date: |
Sun, 05 Aug 2018 12:36:12 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 6482773d30c96fe886c294036acbc8ad2130bc31
Author: Daniel Stenberg <address@hidden>
AuthorDate: Sun May 27 23:24:27 2018 +0200
fnmatch: insist on escaped bracket to match
A non-escaped bracket ([) is for a character group - as documented. It
will *not* match an individual bracket anymore. Test case 1307 updated
accordingly to match.
Problem detected by OSS-Fuzz, although this fix is probably not a final
fix for the notorious timeout issues.
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8525
Closes #2614
---
lib/curl_fnmatch.c | 4 ++--
tests/unit/unit1307.c | 17 +++++++++++++----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index 268fe79b3..bd4e61f4e 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -334,9 +334,9 @@ static int loop(const unsigned char *pattern, const
unsigned char *string,
s++;
break;
}
+ /* Syntax error in set; mismatch! */
+ return CURL_FNMATCH_NOMATCH;
- /* Syntax error in set: this must be taken as a regular character. */
- /* FALLTHROUGH */
default:
if(*p++ != *s++)
return CURL_FNMATCH_NOMATCH;
diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c
index 5f60332b8..fe16ed324 100644
--- a/tests/unit/unit1307.c
+++ b/tests/unit/unit1307.c
@@ -34,9 +34,17 @@ struct testcase {
static const struct testcase tests[] = {
/* brackets syntax */
+ {"*[*[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
+ "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
+ "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\001\177[[[[[[[[[[[[[[[[[[[[[",
+ "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
+ "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
+ "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[",
+ NOMATCH},
+
{ "\\[", "[", MATCH },
- { "[", "[", MATCH },
- { "[]", "[]", MATCH },
+ { "[", "[", NOMATCH },
+ { "[]", "[]", NOMATCH },
{ "[][]", "[", MATCH },
{ "[][]", "]", MATCH },
{ "[[]", "[", MATCH },
@@ -230,8 +238,9 @@ UNITTEST_START
for(i = 0; i < testnum; i++) {
rc = Curl_fnmatch(NULL, tests[i].pattern, tests[i].string);
if(rc != tests[i].result) {
- printf("Curl_fnmatch(\"%s\", \"%s\") should return %d (returns %d)\n",
- tests[i].pattern, tests[i].string, tests[i].result, rc);
+ printf("Curl_fnmatch(\"%s\", \"%s\") should return %d (returns %d)"
+ " [%d]\n",
+ tests[i].pattern, tests[i].string, tests[i].result, rc, i);
fail("pattern mismatch");
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 50/163: configure: override AR_FLAGS to silence warning, (continued)
- [GNUnet-SVN] [gnurl] 50/163: configure: override AR_FLAGS to silence warning, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 47/163: KNOWN_BUGS: restore text regarding #2101., gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 40/163: curl.1: Fix cmdline-opts reference errors., gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 60/163: configure: check for declaration of getpwuid_r, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 39/163: docs: fix cmdline-opts metadata headers case consistency., gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 26/163: http resume: skip body if http code 416 (range error) is ignored., gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 29/163: TODO: CURLINFO_PAUSE_STATE, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 59/163: tests: update .gitignore for libtests, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 72/163: cmdline-opts/cert-type.d: mention "p12" as a recognized type as well, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 75/163: tests/libtests/Makefile.am: Add lib1521.c to CLEANFILES, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 46/163: fnmatch: insist on escaped bracket to match,
gnunet <=
- [GNUnet-SVN] [gnurl] 63/163: os400: add new option in ILE/RPG binding, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 62/163: tests/libtest/.gitignore: follow-up fix to ignore lib5* too, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 43/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 48/163: INSTALL: LDFLAGS=-Wl, -R/usr/local/ssl/lib, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 49/163: cmake: fixed comments in compile checks code, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 69/163: axTLS: not considered fit for use, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 56/163: libcurl-security.3: improved layout for two rememdy lists, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 66/163: multi: remove a DEBUGF(), gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 78/163: RELEASE-PROCEDURE: update the release calendar for 2019, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 74/163: tests/libtest: Add lib1521 to nodist_SOURCES, gnunet, 2018/08/05