int
ber_realloc( BerElement *ber, ber_len_t len )
{
- ber_len_t total, offset, sos_offset;
+ ber_len_t total, offset, sos_offset, rw_offset;
char *buf;
assert( ber != NULL );
offset = ber->ber_ptr - buf;
sos_offset = ber->ber_sos_ptr ? ber->ber_sos_ptr - buf : 0;
/* if ber_sos_ptr != NULL, it is > ber_buf so that sos_offset > 0 */
+ rw_offset = ber->ber_rwptr ? ber->ber_rwptr - buf : 0;
buf = (char *) ber_memrealloc_x( buf, total, ber->ber_memctx );
if ( buf == NULL ) {
ber->ber_ptr = buf + offset;
if ( sos_offset )
ber->ber_sos_ptr = buf + sos_offset;
+ if ( ber->ber_rwptr )
+ ber->ber_rwptr = buf + rw_offset;
return( 0 );
}