From 696a0751d611578ab30870dd30f9a890cf925cc1 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Fri, 2 Oct 2026 18:54:26 +0900 Subject: [PATCH v1 1/2] Reject v2 protocol startup packet. If v2 frontend connects, raise a FATAL error. Author: Tatsuo Ishii Backpatch-through: master only --- src/protocol/child.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/protocol/child.c b/src/protocol/child.c index 4da5cf12f..cd74f9bd9 100644 --- a/src/protocol/child.c +++ b/src/protocol/child.c @@ -5,7 +5,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2025 PgPool Global Development Group + * Copyright (c) 2003-2026 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -625,7 +625,6 @@ static StartupPacket * read_startup_packet(POOL_CONNECTION *cp) { StartupPacket *sp; - StartupPacket_v2 *sp2; int protov; int len; char *p; @@ -667,15 +666,11 @@ read_startup_packet(POOL_CONNECTION *cp) switch (sp->major) { - case PROTO_MAJOR_V2: /* V2 */ - sp2 = (StartupPacket_v2 *) (sp->startup_packet); - - sp->database = palloc0(SM_DATABASE + 1); - strncpy(sp->database, sp2->database, SM_DATABASE); - - sp->user = palloc0(SM_USER + 1); - strncpy(sp->user, sp2->user, SM_USER); - + case PROTO_MAJOR_V2: /* V2 protocol is not supported */ + ereport(FATAL, + (pool_error_code("0X000"), /* ERRCODE_FEATURE_NOT_SUPPORTED */ + errmsg("unsupported frontend protocol %u.%u", + sp->major, sp->minor))); break; case PROTO_MAJOR_V3: /* V3 */ -- 2.43.0