From: Pierangelo Masarati Date: Thu, 11 Aug 2005 02:09:03 +0000 (+0000) Subject: don't get tricked when option separator occurs past end of berval X-Git-Tag: OPENLDAP_AC_BP~12 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e9cb5b0efb496251d9397f642fa1ac0a83ac2f1e;p=openldap don't get tricked when option separator occurs past end of berval --- diff --git a/servers/slapd/ad.c b/servers/slapd/ad.c index 2aa538e725..5258dc3fc3 100644 --- a/servers/slapd/ad.c +++ b/servers/slapd/ad.c @@ -174,12 +174,15 @@ int slap_bv2ad( } /* find valid base attribute type; parse in place */ - memset( &desc, 0, sizeof( desc )); + memset( &desc, 0, sizeof( desc ) ); desc.ad_cname = *bv; name = bv->bv_val; - options = strchr(name, ';'); - if( options != NULL ) { + options = strchr( name, ';' ); + if ( options != NULL && ( options - name ) < bv->bv_len ) { + /* don't go past the end of the berval! */ desc.ad_cname.bv_len = options - name; + } else { + options = NULL; } desc.ad_type = at_bvfind( &desc.ad_cname ); if( desc.ad_type == NULL ) {