andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 3b3b1c2601ba35ce51b5e5cf8b4002eaa45c1611 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Fri, 14 Mar 2014 12:33:40 -0400
dc8c34
Subject: [PATCH 188/225] Ticket 47740 - Crash caused by changes to certmap.c
dc8c34
dc8c34
Bug Description: dncomps & filtercomps could be incorrectly freed,
dc8c34
                 which lead to a crash.
dc8c34
dc8c34
Fix Description: Allocate "" for dncomps & filtercomps, instead of
dc8c34
                 setting it on the stack.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47740
dc8c34
dc8c34
Reviewed by: rmeggins(Thanks!)
dc8c34
(cherry picked from commit 33b98f1c901f1441dd1f709e244735fa339a287e)
dc8c34
(cherry picked from commit b46e1fddeea9c13537d975e5807f84c4359590ce)
dc8c34
---
dc8c34
 lib/ldaputil/certmap.c | 8 ++++----
dc8c34
 1 file changed, 4 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/lib/ldaputil/certmap.c b/lib/ldaputil/certmap.c
dc8c34
index aa5bafa..0935e4d 100644
dc8c34
--- a/lib/ldaputil/certmap.c
dc8c34
+++ b/lib/ldaputil/certmap.c
dc8c34
@@ -524,7 +524,7 @@ static int process_certinfo (LDAPUCertMapInfo_t *certinfo)
dc8c34
     }
dc8c34
     else if (rv == LDAPU_SUCCESS && !dncomps) {
dc8c34
         certinfo->dncompsState = COMPS_EMPTY;
dc8c34
-        dncomps = "";		/* present but empty */
dc8c34
+        dncomps = strdup("");		/* present but empty */
dc8c34
     }
dc8c34
 
dc8c34
     rv = parse_into_bitmask (dncomps, &certinfo->dncomps, -1);
dc8c34
@@ -547,12 +547,12 @@ static int process_certinfo (LDAPUCertMapInfo_t *certinfo)
dc8c34
     }
dc8c34
     else if (rv == LDAPU_SUCCESS && !filtercomps) {
dc8c34
         certinfo->filtercompsState = COMPS_EMPTY;
dc8c34
-        filtercomps = "";	/* present but empty */
dc8c34
+        filtercomps = strdup("");	/* present but empty */
dc8c34
     }
dc8c34
 
dc8c34
     rv = parse_into_bitmask (filtercomps, &certinfo->filtercomps, 0);
dc8c34
 
dc8c34
-    if (filtercomps) free(filtercomps);
dc8c34
+    free(filtercomps); filtercomps = NULL;
dc8c34
     
dc8c34
     if (rv != LDAPU_SUCCESS) return rv;
dc8c34
 
dc8c34
@@ -590,7 +590,7 @@ static int process_certinfo (LDAPUCertMapInfo_t *certinfo)
dc8c34
     else if (rv == LDAPU_FAILED)  rv = LDAPU_SUCCESS;
dc8c34
 
dc8c34
     if (verify) free(verify);
dc8c34
-    
dc8c34
+
dc8c34
     if (rv != LDAPU_SUCCESS) return rv;
dc8c34
 
dc8c34
     {
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34