Commit cc1d6fe4 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#8864 Fix ber_realloc after a partial ber_flush

parent 11e63c2f
......@@ -128,7 +128,7 @@ ber_write(
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 );
......@@ -165,6 +165,7 @@ ber_realloc( BerElement *ber, ber_len_t len )
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 ) {
......@@ -176,6 +177,8 @@ ber_realloc( BerElement *ber, ber_len_t len )
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 );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment