{
ber_tag_t tag;
unsigned char lc;
- ber_len_t i, noctets;
- unsigned char netlen[sizeof(ber_len_t)];
+ char *save;
assert( ber != NULL );
assert( len != NULL );
assert( LBER_VALID( ber ) );
+ save = ber->ber_ptr;
+
/*
* Any ber element looks like this: tag length contents.
* Assuming everything's ok, we return the tag byte (we
}
if ( lc & 0x80U ) {
+ ber_len_t i, noctets;
+ unsigned char netlen[sizeof(ber_len_t)];
+
noctets = (lc & 0x7fU);
if ( noctets > sizeof(ber_len_t) ) {
}
/* BER element should have enough data left */
- if( *len > (ber_len_t) ber_pvt_ber_remaining( ber ) ) {
+ if( *len > (ber_len_t) (ber_pvt_ber_remaining( ber ) + ber->ber_ptr - save) ) {
return LBER_DEFAULT;
}
ber->ber_tag = *(unsigned char *)ber->ber_ptr;