From: Kurt Zeilenga Date: Thu, 15 May 2003 23:10:30 +0000 (+0000) Subject: ldap_get_ber_attribute_ber fix from HEAD X-Git-Tag: OPENLDAP_REL_ENG_2_1_20~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e63ce287426cf336b8db2071d9bcd5391258604;p=thirdparty%2Fopenldap.git ldap_get_ber_attribute_ber fix from HEAD --- diff --git a/CHANGES b/CHANGES index 0edfea2e5f..bf03ade578 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ OpenLDAP 2.1 Change Log OpenLDAP 2.1.20 Engineering Fixed slapd regex lookup mutex issue (ITS#2505) Fixed back-bdb/ldbm filter indexing bugs (ITS#2506) (ITS#2507) + Fixed libldap ldap_get_attribute_ber bug OpenLDAP 2.1.19 Release Fixed slapd substring index normalization (ITS#2468) diff --git a/libraries/libldap/getattr.c b/libraries/libldap/getattr.c index 6e67e71c68..bbe5020561 100644 --- a/libraries/libldap/getattr.c +++ b/libraries/libldap/getattr.c @@ -121,7 +121,10 @@ ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber ) return attr; } -/* Fetch attribute type and optionally fetch values */ +/* Fetch attribute type and optionally fetch values. The type + * and values are referenced in-place from the BerElement, they are + * not dup'd into malloc'd memory. + */ /* ARGSUSED */ int ldap_get_attribute_ber( LDAP *ld, LDAPMessage *entry, BerElement *ber, @@ -146,8 +149,11 @@ ldap_get_attribute_ber( LDAP *ld, LDAPMessage *entry, BerElement *ber, attr->bv_len = 0; if ( ber_pvt_ber_remaining( ber ) ) { + ber_len_t siz = sizeof( BerValue ); + /* skip sequence, snarf attribute type */ - tag = ber_scanf( ber, vals ? "{mW}" : "{mx}", attr, vals ); + tag = ber_scanf( ber, vals ? "{mM}" : "{mx}", attr, vals, + &siz, 0 ); if( tag == LBER_ERROR ) { rc = ld->ld_errno = LDAP_DECODING_ERROR; }