[PATCH] Fix two CIDs

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Apr 5 12:13:22 UTC 2018


Hi!

Review 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 da37108047990ffc7f757386e6698b80b4e3a2b0 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 5 Apr 2018 10:11:16 +0200
Subject: [PATCH 1/2] eventlog: Fix CID 242105 Unchecked return value

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/eventlog/eventlog.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index f9ac0900150..cc4573c869c 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -966,7 +966,10 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
 			return NT_STATUS_INVALID_SID;
 		}
 		if (len > 0) {
-			string_to_sid(&e->UserSid, sid_str);
+			bool ok = string_to_sid(&e->UserSid, sid_str);
+			if (!ok) {
+				return NT_STATUS_INVALID_SID;
+			}
 		}
 	}
 
-- 
2.11.0


From a140a3a3d070e40657955f33428adeb88e339a9e Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 5 Apr 2018 10:12:41 +0200
Subject: [PATCH 2/2] eventlog: Fix CID 1363194 Resource leak

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

diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index cc4573c869c..9053fdd9a24 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -958,7 +958,7 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
 	NT_STATUS_HAVE_NO_MEMORY(e->Computername);
 
 	if (t->sid_length > 0) {
-		const char *sid_str = NULL;
+		char *sid_str = NULL;
 		size_t len;
 		if (!convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
 					   t->sid.data, t->sid.length,
@@ -971,6 +971,7 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
 				return NT_STATUS_INVALID_SID;
 			}
 		}
+		TALLOC_FREE(sid_str);
 	}
 
 	e->Strings		= talloc_array(mem_ctx, const char *, t->num_of_strings);
-- 
2.11.0



More information about the samba-technical mailing list