Fix node id range check bug in trigger_failover_command().
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 19 Nov 2014 01:32:22 +0000 (10:32 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 19 Nov 2014 01:32:22 +0000 (10:32 +0900)
The node id should be lower than NUM_BACKENDS. Probably harmless since
callers never pass node ids greater or equal to NUM_BACKENDS. But a
bug is a bug.

main.c

diff --git a/main.c b/main.c
index 0727cf39f008bc7c2942277efaf9c41e485483c8..e58e95246a34cfe0e9e146375690fdabbcbf9b94 100644 (file)
--- a/main.c
+++ b/main.c
@@ -2594,7 +2594,7 @@ static int trigger_failover_command(int node, const char *command_line,
                return 0;
 
        /* check failed nodeID */
-       if (node < 0 || node > NUM_BACKENDS)
+       if (node < 0 || node >= NUM_BACKENDS)
                return -1;
 
        info = pool_get_node_info(node);