From da758bb150d6a44de5fba2ca384ca84e9857d47f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 19 Jul 2005 01:32:29 +0000 Subject: [PATCH] Fix crasher in hdb_dn2id() when parent is NULL --- servers/slapd/back-bdb/dn2id.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 3352278c06..2d362830ae 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -634,7 +634,7 @@ hdb_dn2id( diskNode *d; char *ptr; unsigned char dlen[2]; - ID idp; + ID idp, parentID; nrlen = dn_rdnlen( op->o_bd, in ); if (!nrlen) nrlen = in->bv_len; @@ -644,7 +644,8 @@ hdb_dn2id( key.data = &idp; key.ulen = sizeof(ID); key.flags = DB_DBT_USERMEM; - BDB_ID2DISK( ei->bei_parent->bei_id, &idp ); + parentID = ( ei->bei_parent != NULL ) ? ei->bei_parent->bei_id : 0; + BDB_ID2DISK( parentID, &idp ); DBTzero(&data); data.size = sizeof(diskNode) + nrlen - sizeof(ID) - 1; -- 2.39.5