]> git.sur5r.net Git - openldap/commitdiff
Fix crasher in hdb_dn2id() when parent is NULL
authorLuke Howard <lukeh@openldap.org>
Tue, 19 Jul 2005 01:32:29 +0000 (01:32 +0000)
committerLuke Howard <lukeh@openldap.org>
Tue, 19 Jul 2005 01:32:29 +0000 (01:32 +0000)
servers/slapd/back-bdb/dn2id.c

index 3352278c061975a2a556e0ecebd15a0192e5d897..2d362830ae58a963fda955bb60a3073bcc20a7dd 100644 (file)
@@ -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;