From: Kurt Zeilenga Date: Wed, 13 Feb 2002 17:23:33 +0000 (+0000) Subject: Add embedded NUL check. This is one case where we don't want to X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dd12660a142f2b81ec2b5d468012b7ba6516d5ac;p=openldap Add embedded NUL check. This is one case where we don't want to be liberal in what we accept. --- diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 3394ef0b53..11b436bdcf 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -650,8 +650,10 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags ) if ( bv->bv_len == 0 ) { return LDAP_SUCCESS; + } - } else if ( str[ 0 ] == '\0' ) { + if( strlen( bv->bv_val ) != bv->bv_len ) { + /* value must have embedded NULs */ return LDAP_DECODING_ERROR; } @@ -879,7 +881,10 @@ ldap_bv2rdn( struct berval *bv, LDAPRDN **rdn, if ( bv->bv_len == 0 ) { return LDAP_SUCCESS; - } else if ( str[ 0 ] == '\0' ) { + } + + if( strlen( bv->bv_val ) != bv->bv_len ) { + /* value must have embedded NULs */ return LDAP_DECODING_ERROR; }