[PATCH] torture: Fix comparsion of uninitalized bytes.

Andreas Schneider asn at samba.org
Tue Jul 2 07:24:40 MDT 2013


As we compare string make sure we have the null terminator.

Found by valgrind.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/raw/session.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source4/torture/raw/session.c b/source4/torture/raw/session.c
index 5b5b782..fbfdced 100644
--- a/source4/torture/raw/session.c
+++ b/source4/torture/raw/session.c
@@ -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");
-- 
1.8.3.1




More information about the samba-technical mailing list