]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-strfuncs - Avoid testing p_strndup() with overlong max_chars parameter
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 27 Sep 2021 08:49:05 +0000 (11:49 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 27 Sep 2021 08:49:05 +0000 (11:49 +0300)
This ended up in memchr() call with n=SIZE_MAX-1, which sometimes doesn't
work right with old glibc versions.

Fixes:
Panic: Trying to allocate 18446744073709551615 bytes

src/lib/test-strfuncs.c

index f9154709f9cba5c8b1da067ae4d628f72207aae7..b5463846bdc800fbc2a5cf256c49ee3f4c987f03 100644 (file)
@@ -26,7 +26,7 @@ static void test_p_strndup(void)
                { "foo", "fo", 2 },
                { "foo", "foo", 3 },
                { "foo", "foo", 4 },
-               { "foo", "foo", SIZE_MAX-1 },
+               { "foo\0more", "foo", 8 },
        };
        test_begin("p_strndup()");