andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0306-Coverity-fix-Invalid-Dereference-in-ndn_cache_add-dn.patch

dc8c34
From d622ff81fc59cd0694e0b964d21c384469d5fd8e Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Thu, 19 Feb 2015 10:22:02 -0800
dc8c34
Subject: [PATCH] Coverity fix - Invalid Dereference in ndn_cache_add (dn.c)
dc8c34
dc8c34
(cherry picked from commit d132bc4014dc5bd5f69f403ca415de0007713b61)
dc8c34
---
dc8c34
 ldap/servers/slapd/dn.c | 3 ++-
dc8c34
 1 file changed, 2 insertions(+), 1 deletion(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
dc8c34
index 9c1084f..db050c8 100644
dc8c34
--- a/ldap/servers/slapd/dn.c
dc8c34
+++ b/ldap/servers/slapd/dn.c
dc8c34
@@ -2936,7 +2936,8 @@ ndn_cache_add(char *dn, size_t dn_len, char *ndn, size_t ndn_len)
dc8c34
         new_node->next = NULL;
dc8c34
     } else {
dc8c34
         new_node->next = ndn_cache->head;
dc8c34
-        ndn_cache->head->prev = new_node;
dc8c34
+        if(ndn_cache->head)
dc8c34
+            ndn_cache->head->prev = new_node;
dc8c34
     }
dc8c34
     ndn_cache->head = new_node;
dc8c34
     PR_Unlock(lru_lock);
dc8c34
-- 
dc8c34
1.9.3
dc8c34