pgpool2.git / summary / log / commit / refs

commit    01ad5b7553b935396ef320f01fccb87aa339dc59
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Nov 20 07:51:03 2013 +0000

    Fix possible segfault in CopyDataRaws().
    
    Coverity pointed out that if pool_get_id() returns an error,
    VALID_BACKEND will access out of array.  Per Coverity report 1111413
    "Memory - illegal accesses".


src/protocol/pool_proto_modules.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c index 5b968fbbd..af2bdd398 100644 --- a/src/protocol/pool_proto_modules.c +++ b/src/protocol/pool_proto_modules.c @@ -2903,8 +2903,9 @@ POOL_STATUS CopyDataRows(POOL_CONNECTION *frontend, id = pool_get_id(info, p1); pool_debug("CopyDataRow: copying id: %d", id); free(p1); - if (!VALID_BACKEND(id)) + if (id < 0 || !VALID_BACKEND(id)) { + pool_error("CopyDataRow: pool_get_id returns invalid id: %d", id); exit(1); } if (pool_write(CONNECTION(backend, id), &kind, 1)) [parent: 173348a02f51]