Blame SOURCES/0014-Ticket-49850-cont-fix-crash-in-ldbm_non_leaf.patch

4c04d8
From 87b7e568cd1f31ef107a0880dd21198b2b401612 Mon Sep 17 00:00:00 2001
e79480
From: Ludwig Krispenz <lkrispen@redhat.com>
e79480
Date: Thu, 24 Oct 2019 14:26:20 +0200
e79480
Subject: [PATCH] Ticket 49850 cont -fix crash in ldbm_non_leaf
e79480
e79480
        Bug: if the ldif to be imported contains only one entry there are no leaf nodes
e79480
                and the call to qsort crashes
e79480
e79480
        Fix: check that nodes is not NULL
e79480
---
e79480
 ldap/servers/slapd/back-ldbm/ancestorid.c | 2 +-
e79480
 1 file changed, 1 insertion(+), 1 deletion(-)
e79480
e79480
diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c
e79480
index 254a3aa3b..f26ac1364 100644
e79480
--- a/ldap/servers/slapd/back-ldbm/ancestorid.c
e79480
+++ b/ldap/servers/slapd/back-ldbm/ancestorid.c
e79480
@@ -114,7 +114,7 @@ ldbm_get_nonleaf_ids(backend *be, DB_TXN *txn, IDList **idl, ImportJob *job)
e79480
     if (ret != 0)
e79480
         ldbm_nasty("ldbm_get_nonleaf_ids", sourcefile, 13030, ret);
e79480
 
e79480
-    if (ret == 0) {
e79480
+    if (ret == 0 && nodes) {
e79480
         /* now sort it */
e79480
         import_log_notice(job, SLAPI_LOG_INFO, "ldbm_get_nonleaf_ids",
e79480
             "Starting sort of ancestorid non-leaf IDs...");
e79480
-- 
e79480
2.21.0
e79480