From: Howard Chu Date: Wed, 26 Dec 2001 13:45:22 +0000 (+0000) Subject: Add optional len to ber_str2bv X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~503 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=327f253183e540424b1aff178872499d988d42b9;p=openldap Add optional len to ber_str2bv --- 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;