CVE-2021-20277 ldb tests: ldb_match tests with extra spaces
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 5 Mar 2021 07:13:01 +0000 (20:13 +1300)
committerKarolin Seeger <kseeger@samba.org>
Fri, 19 Mar 2021 07:51:01 +0000 (08:51 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14655

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry-picked from commit for master)

lib/ldb/tests/ldb_match_test.c

index 3028aed072c678ca8226a13dd4c744eb791a7ec2..ba6ea56be158bc39296e7f66fdc929add5120a4a 100644 (file)
@@ -181,6 +181,8 @@ static void test_wildcard_match(void **state)
        size_t failed = 0;
        size_t i;
        struct wildcard_test tests[] = {
+               TEST_ENTRY("                     1  0", "1*0*", true, true),
+               TEST_ENTRY("                     1  0", "1 *0", true, true),
                TEST_ENTRY("The value.......end", "*end", true, true),
                TEST_ENTRY("The value.......end", "*fend", false, true),
                TEST_ENTRY("The value.......end", "*eel", false, true),
@@ -203,8 +205,12 @@ static void test_wildcard_match(void **state)
                TEST_ENTRY("1\n0\r0\t000.0.0.0.0", "1*0*0*0*0*0*0*0*0", true,
                           true),
                /*
-                *  We allow NUL bytes in non-casefolding syntaxes.
+                *  We allow NUL bytes and redundant spaces in non-casefolding
+                *  syntaxes.
                 */
+               TEST_ENTRY("                  1  0", "*1  0", true, false),
+               TEST_ENTRY("                  1  0", "*1  0", true, false),
+               TEST_ENTRY("1    0", "*1 0", false, false),
                TEST_ENTRY("1\x00 x", "1*x", true, false),
                TEST_ENTRY("1\x00 x", "*x", true, false),
                TEST_ENTRY("1\x00 x", "*x*", true, false),