diff --git a/include/lber.h b/include/lber.h index 16447557bd..7154544f80 100644 --- a/include/lber.h +++ b/include/lber.h @@ -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(( diff --git a/libraries/liblber/memory.c b/libraries/liblber/memory.c index 4766a21f23..52fee40532 100644 --- a/libraries/liblber/memory.c +++ b/libraries/liblber/memory.c @@ -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;