[PATCH] torture: Fix comparsion of uninitalized bytes.

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jul 2 09:49:17 MDT 2013


On Tue, Jul 02, 2013 at 03:24:40PM +0200, Andreas Schneider wrote:
> 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");

Reviewed-by: Volker Lendecke <vl at samba.org>

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list