From: Tatsuo Ishii Date: Wed, 17 Jul 2019 07:51:31 +0000 (+0900) Subject: Fix the failover() so that it does not access out of array. X-Git-Tag: V3_7_11~17 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=cd352426e8e9ee2dfac8cce0138676d98e7dfa98;p=pgpool2.git Fix the failover() so that it does not access out of array. Per Coverity. --- diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index f7591da20..2eeeb40c1 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -2025,6 +2025,7 @@ static void failover(void) { /* only if the failover is against the current primary */ if (((reqkind == NODE_DOWN_REQUEST) && + Req_info->primary_node_id >= 0 && (nodes[Req_info->primary_node_id])) || (node_id >= 0 && (reqkind == PROMOTE_NODE_REQUEST) && (VALID_BACKEND(node_id))))