From: Andreas Schneider Date: Mon, 16 Aug 2021 10:42:47 +0000 (+0200) Subject: testsuite: Fix build with gcc >= 11.1.1 X-Git-Tag: ldb-2.5.0~969 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ce08f72a9e2558e8720b463e68174e430a67654;p=thirdparty%2Fsamba.git testsuite: Fix build with gcc >= 11.1.1 Pair-Programmed-With: Jeremy Allison Signed-off-by: Andreas Schneider Signed-off-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Mon Aug 16 17:20:37 UTC 2021 on sn-devel-184 --- diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c index f5769b4dc4d..c0dcda55bd2 100644 --- a/lib/replace/tests/testsuite.c +++ b/lib/replace/tests/testsuite.c @@ -308,6 +308,8 @@ static int test_strndup(void) static int test_strnlen(void) { + char longlen[20] = { 0 }; + printf("test: strnlen\n"); if (strnlen("bla", 2) != 2) { printf("failure: strnlen [\nunexpected length\n]\n"); @@ -319,7 +321,9 @@ static int test_strnlen(void) return false; } - if (strnlen("some text", 20) != 9) { + memcpy(longlen, "some text", 10); + + if (strnlen(longlen, 20) != 9) { printf("failure: strnlen [\nunexpected length\n]\n"); return false; }