andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 515c57545df1958f90571461e6a1109e5c40522d Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Tue, 25 Feb 2014 14:33:48 -0800
Subject: [PATCH 91/92] Ticket 408 - create a normalized dn cache

covscan Defect type: FORWARD_NULL
15. 389-ds-base-1.3.1.6/ldap/servers/slapd/dn.c:3036:var_deref_op -
    Dereferencing null pointer "node".
Introduced by commit 1d6dd39fb8b0ef8eb42ec9ef8c3d325e27a3d3c1
Fix: Check if "node" is null or not before referencing.

Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
(cherry picked from commit 5ac08038a05877b4240755801debd5e5a3a94c6f)
(cherry picked from commit 977c1b293beb0e8324a99614705ba316d46352f8)
(cherry picked from commit 056d390f9ee97f02447ae802deb388ec41bf6925)
---
 ldap/servers/slapd/dn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index 1eab631..4a11a18 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -3003,7 +3003,7 @@ ndn_cache_flush()
     int i;
 
     node = ndn_cache->tail;
-    for(i = 0; i < NDN_FLUSH_COUNT && ndn_cache->cache_count > NDN_MIN_COUNT; i++){
+    for(i = 0; node && i < NDN_FLUSH_COUNT && ndn_cache->cache_count > NDN_MIN_COUNT; i++){
         flush_node = node;
         /* update the lru */
         next = node->prev;
-- 
1.8.1.4