[s3] CID 1427623 and possible memory leak

Swen Schillig swen at vnet.ibm.com
Fri May 25 09:04:52 UTC 2018


Please review and push if happy.

Cheers Swen
-------------- next part --------------
From 63ed86fc33ad8fc39e9c04dec64813cf5509a27d Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Fri, 25 May 2018 10:40:54 +0200
Subject: [PATCH 1/2] [s3] Possible memory leak in map_info3_to_validation

In case of a failing call to copy_netr_SamInfo3, the allocated memory
for "validation needs to be free'd before returning.

Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
 source3/rpc_client/util_netlogon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/rpc_client/util_netlogon.c b/source3/rpc_client/util_netlogon.c
index 4dfdbfed4e6..fa09a1b01a1 100644
--- a/source3/rpc_client/util_netlogon.c
+++ b/source3/rpc_client/util_netlogon.c
@@ -357,6 +357,7 @@ NTSTATUS map_info3_to_validation(TALLOC_CTX *mem_ctx,
 				    info3,
 				    &validation->sam3);
 	if (!NT_STATUS_IS_OK(status)) {
+		TALLOC_FREE(validation);
 		return status;
 	}
 
-- 
2.14.3


From 500b7733730d8186e03e236a467d12ddbb32e399 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Fri, 25 May 2018 10:46:52 +0200
Subject: [PATCH 2/2] [s3] CID 1427623: Explicit NULL dereference.

Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
 source3/rpc_client/util_netlogon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source3/rpc_client/util_netlogon.c b/source3/rpc_client/util_netlogon.c
index fa09a1b01a1..1d1ae7556e9 100644
--- a/source3/rpc_client/util_netlogon.c
+++ b/source3/rpc_client/util_netlogon.c
@@ -70,6 +70,10 @@ NTSTATUS copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
 	unsigned int i;
 	NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
+	if (in == NULL) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
 	info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
 	if (info3 == NULL) {
 		status = NT_STATUS_NO_MEMORY;
-- 
2.14.3



More information about the samba-technical mailing list