don't get tricked when option separator occurs past end of berval

This commit is contained in:
Pierangelo Masarati 2005-08-11 02:09:03 +00:00
parent ba0996f1c1
commit e9cb5b0efb

View File

@ -178,8 +178,11 @@ int slap_bv2ad(
desc.ad_cname = *bv; desc.ad_cname = *bv;
name = bv->bv_val; name = bv->bv_val;
options = strchr( name, ';' ); options = strchr( name, ';' );
if( options != NULL ) { if ( options != NULL && ( options - name ) < bv->bv_len ) {
/* don't go past the end of the berval! */
desc.ad_cname.bv_len = options - name; desc.ad_cname.bv_len = options - name;
} else {
options = NULL;
} }
desc.ad_type = at_bvfind( &desc.ad_cname ); desc.ad_type = at_bvfind( &desc.ad_cname );
if( desc.ad_type == NULL ) { if( desc.ad_type == NULL ) {