torture: Fix comparsion of uninitalized bytes.
authorAndreas Schneider <asn@samba.org>
Tue, 2 Jul 2013 13:24:40 +0000 (15:24 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 4 Jul 2013 07:33:28 +0000 (09:33 +0200)
As we compare string make sure we have the null terminator.

Found by valgrind.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 474eee0df7893a3a4546e1c6ea47220700c5b99f)

source4/torture/raw/session.c

index 5b5b782a1c97327ac8df759f909fd543f662fc0b..fbfdced2f84e6227f96ba59692b0268ad26d9c94 100644 (file)
@@ -70,6 +70,8 @@ static bool test_session_reauth1(struct torture_context *tctx,
        torture_assert_ntstatus_ok_goto(tctx, status, ok, done, "setup2");
        torture_assert_int_equal_goto(tctx, io.out.vuid, vuid1, ok, done, "setup2");
 
+       buf[dlen] = '\0';
+
        num = smbcli_read(cli->tree, fnum, &buf, 0, dlen);
        torture_assert_int_equal_goto(tctx, num, dlen, ok, done, "read file");
        torture_assert_str_equal_goto(tctx, buf, data, ok, done, "read file");