]> git.sur5r.net Git - openldap/commitdiff
Add embedded NUL check. This is one case where we don't want to
authorKurt Zeilenga <kurt@openldap.org>
Wed, 13 Feb 2002 17:23:33 +0000 (17:23 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 13 Feb 2002 17:23:33 +0000 (17:23 +0000)
be liberal in what we accept.

libraries/libldap/getdn.c

index 3394ef0b539d5f75b76bd2f81fafbc86779cd47f..11b436bdcf6391bcf1b0e9343b92f4bd69fd26df 100644 (file)
@@ -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;
        }