From: Timo Sirainen Date: Mon, 27 Sep 2021 08:49:05 +0000 (+0300) Subject: lib: test-strfuncs - Avoid testing p_strndup() with overlong max_chars parameter X-Git-Tag: 2.3.17~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a70b02bbb44ecb774562cb8b4559b2ec823c2d1;p=thirdparty%2Fdovecot%2Fcore.git lib: test-strfuncs - Avoid testing p_strndup() with overlong max_chars parameter 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 --- diff --git a/src/lib/test-strfuncs.c b/src/lib/test-strfuncs.c index f9154709f9..b5463846bd 100644 --- a/src/lib/test-strfuncs.c +++ b/src/lib/test-strfuncs.c @@ -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()");