From: Luke Howard Date: Tue, 19 Jul 2005 01:32:29 +0000 (+0000) Subject: Fix crasher in hdb_dn2id() when parent is NULL X-Git-Tag: OPENLDAP_AC_BP~347 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=da758bb150d6a44de5fba2ca384ca84e9857d47f;p=openldap Fix crasher in hdb_dn2id() when parent is NULL --- 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;