From: Kurt Zeilenga Date: Mon, 8 Nov 1999 19:36:30 +0000 (+0000) Subject: Backout premature commit. X-Git-Tag: UCDATA_2_4~227 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5f3ec33b0cb8a1504f01b0c061a46f5d10793ad3;p=openldap Backout premature commit. --- diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index e8b889d2e7..f150e756fd 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -135,21 +135,23 @@ ber_peek_tag( BerElement *ber_in, ber_len_t *len ) { - char* save; + ber_tag_t tag; BerElement *ber; - ber_tag_t tag; assert( ber_in != NULL ); assert( BER_VALID( ber_in ) ); - /* save state */ - save = ber->ber_ptr; + ber = ber_dup( ber_in ); - tag = ber_skip_tag( ber, len ); + if( ber == NULL ) { + return LBER_ERROR; + } - /* restore state */ - ber->ber_ptr = save; + assert( BER_VALID( ber ) ); + tag = ber_skip_tag( ber, len ); + + ber_free( ber, 0 ); return( tag ); } @@ -451,7 +453,8 @@ ber_first_element( /* skip the sequence header, use the len to mark where to stop */ if ( ber_skip_tag( ber, len ) == LBER_DEFAULT ) { - return( LBER_ERROR ); + *last = NULL; + return( LBER_DEFAULT ); } *last = ber->ber_ptr + *len; @@ -476,7 +479,6 @@ ber_next_element( assert( BER_VALID( ber ) ); if ( ber->ber_ptr == last ) { - /* set last to NULL on end of SEQUENCE */ return( LBER_DEFAULT ); }