Blame SOURCES/0082-Ticket-47931-Fix-coverity-issues.patch

b161c9
From 476ffd9a01ac5bb55d32edad64c68eebd8773861 Mon Sep 17 00:00:00 2001
b161c9
From: Mark Reynolds <mreynolds@redhat.com>
b161c9
Date: Mon, 10 Aug 2015 10:42:40 -0400
b161c9
Subject: [PATCH 82/84] Ticket 47931 - Fix coverity issues
b161c9
b161c9
Description:  Fix coverity issues in memberof_config.c
b161c9
b161c9
              13316 - double free
b161c9
              13315 - Dereference after null check
b161c9
              13314 - Dereference after null check
b161c9
              13313 - copy/paste error
b161c9
b161c9
https://fedorahosted.org/389/ticket/47931
b161c9
b161c9
Reviewed by: rmeggins(Thanks!)
b161c9
b161c9
(cherry picked from commit 5daea973e4526584ee41d7b9f4b1b4993b4de6f1)
b161c9
(cherry picked from commit 9a0047ef75f6dbeb1980ac77fab5d62865c77e6a)
b161c9
(cherry picked from commit a389bc3bafccb1f7bd9917a734230680e382af91)
b161c9
---
b161c9
 ldap/servers/plugins/memberof/memberof_config.c | 6 ++++--
b161c9
 1 file changed, 4 insertions(+), 2 deletions(-)
b161c9
b161c9
diff --git a/ldap/servers/plugins/memberof/memberof_config.c b/ldap/servers/plugins/memberof/memberof_config.c
b161c9
index 5fc1314..c335cab 100644
b161c9
--- a/ldap/servers/plugins/memberof/memberof_config.c
b161c9
+++ b/ldap/servers/plugins/memberof/memberof_config.c
b161c9
@@ -335,6 +335,7 @@ memberof_validate_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
b161c9
 					"%s: Invalid DN (%s) for include suffix.",
b161c9
 					MEMBEROF_PLUGIN_SUBSYSTEM, entry_scopes[i]);
b161c9
 				slapi_ch_array_free(entry_scopes);
b161c9
+				entry_scopes = NULL;
b161c9
 				theConfig.entryScopeCount = 0;
b161c9
 				*returncode = LDAP_UNWILLING_TO_PERFORM;
b161c9
 				goto done;
b161c9
@@ -360,8 +361,9 @@ memberof_validate_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
b161c9
 				/* invalid dn syntax */
b161c9
 				PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
b161c9
 					"%s: Invalid DN (%s) for exclude suffix.",
b161c9
-					MEMBEROF_PLUGIN_SUBSYSTEM, entry_scopes[i]);
b161c9
+					MEMBEROF_PLUGIN_SUBSYSTEM, entry_exclude_scopes[i]);
b161c9
 				slapi_ch_array_free(entry_exclude_scopes);
b161c9
+				entry_exclude_scopes = NULL;
b161c9
 				*returncode = LDAP_UNWILLING_TO_PERFORM;
b161c9
 				goto done;
b161c9
 			}
b161c9
@@ -747,7 +749,7 @@ memberof_copy_config(MemberOfConfig *dest, MemberOfConfig *src)
b161c9
 			int num_vals = 0;
b161c9
 
b161c9
 			dest->entryScopeExcludeSubtrees = (Slapi_DN **)slapi_ch_calloc(sizeof(Slapi_DN *),src->entryExcludeScopeCount+1);
b161c9
-			for(num_vals = 0; src->entryScopes[num_vals]; num_vals++){
b161c9
+			for(num_vals = 0; src->entryScopeExcludeSubtrees[num_vals]; num_vals++){
b161c9
 				dest->entryScopeExcludeSubtrees[num_vals] = slapi_sdn_dup(src->entryScopeExcludeSubtrees[num_vals]);
b161c9
 			}
b161c9
 		}
b161c9
-- 
b161c9
1.9.3
b161c9