From 52b3eb0f5524300f2a98699ffb8803c46854ae69 Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Oct 24 2019 12:07:45 +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/db-bdb/bdb_import.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import.c index 79c9c7c..67ff3e3 100644 --- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import.c +++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import.c @@ -489,7 +489,7 @@ bdb_get_nonleaf_ids(backend *be, DB_TXN *txn, IDList **idl, ImportJob *job) if (ret != 0) ldbm_nasty("bdb_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...");