mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Add optional len to ber_str2bv
This commit is contained in:
parent
a1460e74ce
commit
327f253183
@ -552,10 +552,10 @@ ber_dupbv LDAP_P((
|
||||
|
||||
LBER_F( struct berval * )
|
||||
ber_str2bv LDAP_P((
|
||||
LDAP_CONST char *, int dup, struct berval *bv ));
|
||||
LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv));
|
||||
|
||||
#define ber_bvstr(a) ber_str2bv(a, 0, NULL)
|
||||
#define ber_bvstrdup(a) ber_str2bv(a, 1, NULL)
|
||||
#define ber_bvstr(a) ber_str2bv(a, 0, 0, NULL)
|
||||
#define ber_bvstrdup(a) ber_str2bv(a, 0, 1, NULL)
|
||||
|
||||
LBER_F( char * )
|
||||
ber_strdup LDAP_P((
|
||||
|
@ -489,7 +489,7 @@ ber_dupbv(
|
||||
|
||||
struct berval *
|
||||
ber_str2bv(
|
||||
LDAP_CONST char *s, int dup, struct berval *bv )
|
||||
LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv)
|
||||
{
|
||||
struct berval *new;
|
||||
|
||||
@ -509,7 +509,7 @@ ber_str2bv(
|
||||
}
|
||||
}
|
||||
|
||||
new->bv_len = strlen( s );
|
||||
new->bv_len = len ? len : strlen( s );
|
||||
if ( dup ) {
|
||||
if ( (new->bv_val = LBER_MALLOC( new->bv_len+1 )) == NULL ) {
|
||||
ber_errno = LBER_ERROR_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user