pgpool2.git / summary / log / commit / refs

commit    6ab169f3e34bcae23cbe6505c1a472ff35201218
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Aug 15 05:24:46 2012 +0000

    Fix read_startup_packet. If packet length is lower than 0, it should
    have returned immediately. Otherwise it would cause memory allocation
    error later on.  per pgpool-general:886.
    Also add canceling alarm.


child.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/child.c b/child.c index 23df92f33..7884372da 100644 --- a/child.c +++ b/child.c @@ -5,7 +5,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2011 PgPool Global Development Group + * Copyright (c) 2003-2012 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -829,14 +829,12 @@ static StartupPacket *read_startup_packet(POOL_CONNECTION *cp) len = ntohl(len); len -= sizeof(len); - if (len <= 0) + if (len <= 0 || len >= MAX_STARTUP_PACKET_LENGTH) { pool_error("read_startup_packet: incorrect packet length (%d)", len); - } - else if (len >= MAX_STARTUP_PACKET_LENGTH) - { - pool_error("read_startup_packet: invalid startup packet"); pool_free_startup_packet(sp); + alarm(0); + pool_signal(SIGALRM, SIG_IGN); return NULL; } [parent: 4ac724ba6d2c]