From 048547a6528918ce9f0412365f7c28d649cd19f5 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 28 Jun 1999 20:12:30 +0000 Subject: [PATCH] modify ber_put_berval to put NULL ostring when bv == NULL or bv->bv_len == 0. --- libraries/liblber/encode.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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; -- 2.39.5