]> git.sur5r.net Git - openldap/commitdiff
modify ber_put_berval to put NULL ostring when bv == NULL or bv->bv_len == 0.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 28 Jun 1999 20:12:30 +0000 (20:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 28 Jun 1999 20:12:30 +0000 (20:12 +0000)
libraries/liblber/encode.c

index 4e5081a830b0dbfbbed470c82c4808f7fc006afc..b5c4561fd10ee4fc5fe1230c1cf2c9160801e8a3 100644 (file)
@@ -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;