andykimpe / rpms / 389-ds-base

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

Blame 0394-Ticket-47858-Internal-searches-using-OP_FLAG_REVERSE.patch

dc8c34
From 90b8bd881fccd964199953bc038f0d6f6b903015 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Mon, 14 Jul 2014 10:47:52 -0400
dc8c34
Subject: [PATCH 394/394] Ticket 47858 - Internal searches using
dc8c34
 OP_FLAG_REVERSE_CANDIDATE_ORDER can crash the server
dc8c34
dc8c34
Bug Description:  If an internal search uses OP_FLAG_REVERSE_CANDIDATE_ORDER, and
dc8c34
                  the search fails tro find any candidates the server will crash.
dc8c34
dc8c34
Fix Description:  Make sure we do not dereference a NULL sr_candidates pointer in
dc8c34
                  ldbm_search().
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47858
dc8c34
dc8c34
Reviewed by: rmeggins(Thanks!)
dc8c34
dc8c34
(cherry picked from commit e6cee31aa2beb6496df86490776f1f93d3a8348b)
dc8c34
(cherry picked from commit da318fa5f147e229069b13c0479fdf81ccc28213)
dc8c34
(cherry picked from commit 7dc69db08c6949ec43a55058e2318158d023770c)
dc8c34
(cherry picked from commit 7a41ef4039e3d0a01064c23d4000eb2b632d724b)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_search.c | 2 +-
dc8c34
 1 file changed, 1 insertion(+), 1 deletion(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
index d468481..952b987 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
@@ -1460,7 +1460,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
dc8c34
          * search can enter this function multiple times, we need to keep track
dc8c34
          * of our state, and only initialize sr_current once.
dc8c34
          */
dc8c34
-        if(!op->o_reverse_search_state){
dc8c34
+        if(!op->o_reverse_search_state && sr->sr_candidates){
dc8c34
             sr->sr_current = sr->sr_candidates->b_nids;
dc8c34
             op->o_reverse_search_state = REV_STARTED;
dc8c34
         }
dc8c34
-- 
dc8c34
2.4.11
dc8c34