]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: let test_ndr_push_string() use strncmp() as strings might not be terminated
authorStefan Metzmacher <metze@samba.org>
Fri, 22 May 2026 15:32:30 +0000 (15:32 +0000)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 May 2026 11:26:33 +0000 (11:26 +0000)
Otherwise this is not reliable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=16006

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source4/torture/ndr/string.c

index 16d3fc37967f75fa8daad88d324ae5dc08ffa63f..3b891c087cf26503b5160e05e335f11d1d0b0991 100644 (file)
@@ -63,7 +63,7 @@ test_ndr_push_string (struct torture_context *tctx, const char *string,
                               "ndr_push_string: succeeded but NULL data");
 
                torture_assert(tctx,
-                              strcmp_pass == !strcmp(string, (char *)ndr->data),
+                              strcmp_pass == !strncmp(string, (char *)ndr->data, expected_offset),
                               "ndr_push_string: post-push strcmp");
 
        }