]> git.sur5r.net Git - openldap/commitdiff
Use memchr, not strlen, to look for embedded NULs.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 13 Feb 2002 17:48:39 +0000 (17:48 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 13 Feb 2002 17:48:39 +0000 (17:48 +0000)
libraries/libldap/getdn.c

index 11b436bdcf6391bcf1b0e9343b92f4bd69fd26df..15980e2c2c41e1f5b27830005fb72fdccf02b44a 100644 (file)
@@ -652,7 +652,7 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
                return LDAP_SUCCESS;
        }
 
-       if( strlen( bv->bv_val ) != bv->bv_len ) {
+       if( memchr( bv->bv_val, '\0', bv->bv_len ) != NULL ) {
                /* value must have embedded NULs */
                return LDAP_DECODING_ERROR;
        }
@@ -883,7 +883,7 @@ ldap_bv2rdn( struct berval *bv, LDAPRDN **rdn,
 
        }
 
-       if( strlen( bv->bv_val ) != bv->bv_len ) {
+       if( memchr( bv->bv_val, '\0', bv->bv_len ) != NULL ) {
                /* value must have embedded NULs */
                return LDAP_DECODING_ERROR;
        }