From: Kurt Zeilenga Date: Wed, 13 Feb 2002 17:48:39 +0000 (+0000) Subject: Use memchr, not strlen, to look for embedded NULs. X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=427478a75328d87b18f9b4d044697edf0d53441e;p=openldap Use memchr, not strlen, to look for embedded NULs. --- diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 11b436bdcf..15980e2c2c 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -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; }