Fix sending invalid message in SI mode.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 1 Jul 2021 04:41:34 +0000 (13:41 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 1 Jul 2021 04:48:58 +0000 (13:48 +0900)
When a query is aborted by specific reason like serialization error,
Pgpool-II sends error query to abort transactions running on non main
nodes. The message length of the query was incorrect and it caused
"invalid string in message" error on backend.

src/protocol/pool_proto_modules.c

index 44ba933532e6673e01e7264b432a47567d6e5e0d..fdd526e0cbb1b99b105c6863cbb9ac0f85644f0a 100644 (file)
@@ -674,7 +674,7 @@ POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend,
                if (specific_error)
                {
                        char msg[1024] = POOL_ERROR_QUERY; /* large enough */
-                       int len = strlen(msg);
+                       int len = strlen(msg) + 1;
 
                        memset(msg + len, 0, sizeof(int));