}
 
        /* FIXME: str2dn should take a bv and handle this */
-       if( strlen( val->bv_val ) != val->bv_len ) {
+       if( strlen( in->bv_val ) != in->bv_len ) {
                return LDAP_INVALID_SYNTAX;
        }
 
                LDAPDN          *dn = NULL;
                int             rc;
 
+               /* FIXME: str2dn should take a bv and handle this */
+               if( strlen( val->bv_val ) != val->bv_len ) {
+                       return LDAP_INVALID_SYNTAX;
+               }
+
                /* FIXME: should be liberal in what we accept */
                rc = ldap_str2dn( val->bv_val, &dn, LDAP_DN_FORMAT_LDAP );
                if ( rc != LDAP_SUCCESS ) {