From e1bc14f91a40410007e0704fb49a41c7052a44aa Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Oct 24 2019 12:26:20 +0000 Subject: Ticket 49850 cont -fix crash in ldbm_non_leaf Bug: if the ldif to be imported contains only one entry there are no leaf nodes and the call to qsort crashes Fix: check that nodes is not NULL --- diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c index 254a3aa..f26ac13 100644 --- a/ldap/servers/slapd/back-ldbm/ancestorid.c +++ b/ldap/servers/slapd/back-ldbm/ancestorid.c @@ -114,7 +114,7 @@ ldbm_get_nonleaf_ids(backend *be, DB_TXN *txn, IDList **idl, ImportJob *job) if (ret != 0) ldbm_nasty("ldbm_get_nonleaf_ids", sourcefile, 13030, ret); - if (ret == 0) { + if (ret == 0 && nodes) { /* now sort it */ import_log_notice(job, SLAPI_LOG_INFO, "ldbm_get_nonleaf_ids", "Starting sort of ancestorid non-leaf IDs...");