[PATCH] Don't modify memory reference provided by value

Swen Schillig swen at vnet.ibm.com
Tue Feb 6 08:40:45 UTC 2018


Hi

Please review this very small patch.

Thanks in advance.

Cheers Swen
-------------- next part --------------
From 1133dd5800d77f7e2c20dba601f8ccd24824d255 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Tue, 6 Feb 2018 09:33:11 +0100
Subject: [PATCH] Don't modify memory reference provided by value

talloc_move cannot be used on a memory reference which is
provided by value. In addition the zero'ing of this reference
is useless as it doesn't have any effect on the caller side.
Even worse, the caller is de-referencing the memory afterwards.
Instead do a talloc_memdup.

Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
 source3/smbd/aio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 4fc1132be87..9a4f5b17152 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -497,7 +497,8 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
 		return NT_STATUS_RETRY;
 	}
 
-	aio_ex->smbreq = talloc_move(aio_ex, &smbreq);
+	aio_ex->smbreq = talloc_memdup(aio_ex, smbreq,
+				       sizeof(struct smb_request));
 
 	/* This should actually be improved to span the write. */
 	contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WRITE);
-- 
2.14.3



More information about the samba-technical mailing list