[PATCH] fix/simplify vfswrap_fsctl

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Feb 12 07:27:52 MST 2014


Hi!

Review would be appreciated!

Thanks,

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
-------------- next part --------------
From 3bbf3afab1943ed1d3370ea0845620ead191be3b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 6 Feb 2014 15:40:46 +0000
Subject: [PATCH 1/2] smbd: Fix an uninitialized read

We have to ship 64 bytes, and we have to initialize the whole thing.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/modules/vfs_default.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 815dc43..5c48d04 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1065,6 +1065,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		push_file_id_16(return_data, &fsp->file_id);
 		memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16);
 		push_file_id_16(return_data+32, &fsp->file_id);
+		memset(return_data+48, 0, 16);
 		*out_data = return_data;
 		return NT_STATUS_OK;
 	}
-- 
1.7.9.5


From cba23549871fd243b4ccbc6cc7800b737aefe0d1 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 12 Feb 2014 14:22:26 +0000
Subject: [PATCH 2/2] smbd: Slightly simplify vfswrap_fsctl

We have the MIN macro, so use it :-)

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/modules/vfs_default.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5c48d04..81a0b1b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1054,7 +1054,8 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		DEBUG(10,("FSCTL_CREATE_OR_GET_OBJECT_ID: called on %s\n",
 			  fsp_fnum_dbg(fsp)));
 
-		*out_len = (max_out_len >= 64) ? 64 : max_out_len;
+		*out_len = MIN(max_out_len, 64);
+
 		/* Hmmm, will this cause problems if less data asked for? */
 		return_data = talloc_array(ctx, char, 64);
 		if (return_data == NULL) {
-- 
1.7.9.5



More information about the samba-technical mailing list