From 4b4d697f7b3eae00da83ef38e22a01d1033e4c61 Mon Sep 17 00:00:00 2001 From: Kuntal Ghosh Date: Wed, 28 Aug 2024 07:05:47 +0000 Subject: [PATCH] Error check for invalid TDS login request --- contrib/babelfishpg_tds/src/backend/tds/tdslogin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/babelfishpg_tds/src/backend/tds/tdslogin.c b/contrib/babelfishpg_tds/src/backend/tds/tdslogin.c index c4907a8b34..37f7edd81e 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tdslogin.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tdslogin.c @@ -759,7 +759,8 @@ FetchLoginRequest(LoginRequest request) return STATUS_ERROR; /* Check we indeed got the correct packet */ - Assert(TdsCheckMessageType(TDS_LOGIN7)); + if (!TdsCheckMessageType(TDS_LOGIN7)) + return STATUS_ERROR; /* fix the client version now */ request->clientProVersion = pg_bswap32(request->clientProVersion);