[PATCH] smbd/smb2_ioctl: check for NULL dst_fsp before use

David Disseldorp ddiss at samba.org
Tue May 16 12:03:32 UTC 2017


...not after. CID #1409040.

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source3/smbd/smb2_ioctl_filesys.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c
index fbff97cc830..392372ffecd 100644
--- a/source3/smbd/smb2_ioctl_filesys.c
+++ b/source3/smbd/smb2_ioctl_filesys.c
@@ -186,16 +186,17 @@ static struct tevent_req *fsctl_dup_extents_send(TALLOC_CTX *mem_ctx,
 	if (req == NULL) {
 		return NULL;
 	}
-	*state = (struct fsctl_dup_extents_state) {
-		.conn = dst_fsp->conn,
-		.ev = ev,
-	};
 
 	if (dst_fsp == NULL) {
 		tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
 		return tevent_req_post(req, ev);
 	}
 
+	*state = (struct fsctl_dup_extents_state) {
+		.conn = dst_fsp->conn,
+		.ev = ev,
+	};
+
 	if ((dst_fsp->conn->fs_capabilities
 				& FILE_SUPPORTS_BLOCK_REFCOUNTING) == 0) {
 		DBG_INFO("FS does not advertise block refcounting support\n");
-- 
2.12.0




More information about the samba-technical mailing list