]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
testsuite: Fix build with gcc >= 11.1.1
authorAndreas Schneider <asn@samba.org>
Mon, 16 Aug 2021 10:42:47 +0000 (12:42 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 16 Aug 2021 17:20:37 +0000 (17:20 +0000)
Pair-Programmed-With: Jeremy Allison <jra@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug 16 17:20:37 UTC 2021 on sn-devel-184

lib/replace/tests/testsuite.c

index f5769b4dc4df1a87af851fdb2ff03fd8eed7cf91..c0dcda55bd2d106c8515d46280aac6ed02f62375 100644 (file)
@@ -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;
        }