From fcaa1826bd34c2a7ea7e71bfd2cfdcf5fe3506c1 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Mon, 29 Jan 2018 16:21:50 +0100 Subject: fnmatch: accept an alphanum to be followed by a non-alphanum in char set Also be more tolerant about set pattern syntax. Update unit test 1307 accordingly. Bug: https://curl.haxx.se/mail/lib-2018-01/0114.html --- tests/unit/unit1307.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index eff5edebc..5aa23d0dc 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -36,8 +36,8 @@ struct testcase { static const struct testcase tests[] = { /* brackets syntax */ { "\\[", "[", MATCH }, - { "[", "[", RE_ERR }, - { "[]", "[]", RE_ERR }, + { "[", "[", MATCH }, + { "[]", "[]", MATCH }, { "[][]", "[", MATCH }, { "[][]", "]", MATCH }, { "[[]", "[", MATCH }, @@ -49,6 +49,8 @@ static const struct testcase tests[] = { { "[][[[]", "[", MATCH }, { "[[]", "]", NOMATCH }, + { "[a@]", "a", MATCH }, + { "[a-z]", "a", MATCH }, { "[a-z]", "A", NOMATCH }, { "?[a-z]", "?Z", NOMATCH }, @@ -77,6 +79,7 @@ static const struct testcase tests[] = { { "[][?*-]", "*", MATCH }, { "[][?*-]", "-", MATCH }, { "[]?*-]", "-", MATCH }, + { "[\xFF]", "\xFF", MATCH }, { "?/b/c", "a/b/c", MATCH }, { "^_{}~", "^_{}~", MATCH }, { "!#%+,-./01234567889", "!#%+,-./01234567889", MATCH }, @@ -98,7 +101,9 @@ static const struct testcase tests[] = { { "*[^a].t?t", "ba.txt", NOMATCH }, { "*[^a].t?t", "ab.txt", MATCH }, { "*[^a]", "", NOMATCH }, - { "[!ΓΏ]", "", NOMATCH }, + { "[!\xFF]", "", NOMATCH }, + { "[!\xFF]", "\xFF", NOMATCH }, + { "[!\xFF]", "a", MATCH }, { "[!?*[]", "?", NOMATCH }, { "[!!]", "!", NOMATCH }, { "[!!]", "x", MATCH }, -- cgit v1.2.3