pgpool2.git / summary / log / commit / refs

commit    3bb2bd8a65d8f4b2e0f1f426a34d2f06d6f2124b
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Tue Aug 15 01:25:35 2017 +0000

    Fix ancient bug of pool_unread.
    
    When realloc() is called in pool_unread(), it did not update the
    buffer size.  This could cause variety of memory corruption and
    unexpected data reading from backend. The reason why we did not found
    that is, probably recently Pgpool-II starts extensively to use
    pool_unread().


src/utils/pool_stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/pool_stream.c b/src/utils/pool_stream.c index 2f8d2f273..f0f31d31f 100644 --- a/src/utils/pool_stream.c +++ b/src/utils/pool_stream.c @@ -1023,6 +1023,7 @@ int pool_unread(POOL_CONNECTION *cp, void *data, int len) MemoryContextSwitchTo(oldContext); cp->hp = p; + cp->bufsz = realloc_size; } if (cp->len != 0) memmove(p + len, cp->hp + cp->po, cp->len); [parent: 7cc3265f74fa]