From 1d24fa6919a4ff7588c20f1a0365fbfcfd404203 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 19 Feb 2013 16:02:01 +0100 Subject: torture: Fix memcmp of short buffer. Reviewed-by: Alexander Bokovoy --- source4/torture/raw/open.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 145651b41d..0968cfec5b 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -1395,7 +1395,7 @@ static bool test_chained(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); fnum = io.openxreadx.out.file.fnum; - if (memcmp(buf, buf2, sizeof(buf)) != 0) { + if (memcmp(buf, buf2, MIN(sizeof(buf), sizeof(buf2))) != 0) { torture_result(tctx, TORTURE_FAIL, "wrong data in reply buffer\n"); ret = false; @@ -1746,7 +1746,7 @@ static bool test_chained_ntcreatex_readx(struct torture_context *tctx, struct sm CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatexreadx.out.file.fnum; - if (memcmp(buf, buf2, sizeof(buf)) != 0) { + if (memcmp(buf, buf2, MIN(sizeof(buf), sizeof(buf2))) != 0) { torture_result(tctx, TORTURE_FAIL, "(%s): wrong data in reply buffer\n", __location__); ret = false; -- cgit