From: Kurt Zeilenga Date: Mon, 28 Jun 1999 20:12:30 +0000 (+0000) Subject: modify ber_put_berval to put NULL ostring when bv == NULL or bv->bv_len == 0. X-Git-Tag: OPENLDAP_REL_ENG_2_BP~236 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=048547a6528918ce9f0412365f7c28d649cd19f5;p=openldap modify ber_put_berval to put NULL ostring when bv == NULL or bv->bv_len == 0. --- diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index 4e5081a830..b5c4561fd1 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -315,12 +315,10 @@ ber_put_berval( ber_tag_t tag ) { assert( ber != NULL ); - assert( bv != NULL ); - assert( BER_VALID( ber ) ); - if( bv == NULL ) { - return -1; + if( bv == NULL || bv->bv_len == 0 ) { + return ber_put_ostring( ber, "", (ber_len_t) 0, tag ); } return ber_put_ostring( ber, bv->bv_val, bv->bv_len, tag ); @@ -728,8 +726,8 @@ va_dcl if ( (bvp = va_arg( ap, struct berval ** )) == NULL ) break; for ( i = 0; bvp[i] != NULL; i++ ) { - if ( (rc = ber_put_ostring( ber, bvp[i]->bv_val, - bvp[i]->bv_len, ber->ber_tag )) == -1 ) + if ( (rc = ber_put_berval( ber, bvp[i], + ber->ber_tag )) == -1 ) break; } break;