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 );
}
/* 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;
assert( BER_VALID( ber ) );
if ( ber->ber_ptr == last ) {
- /* set last to NULL on end of SEQUENCE */
return( LBER_DEFAULT );
}