Fix crasher in hdb_dn2id() when parent is NULL

This commit is contained in:
Luke Howard 2005-07-19 01:32:29 +00:00
parent 54a0c02c3d
commit da758bb150

View 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;