Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdce92e5

Browse files
committed
libpq: Correct processing of startup response messages
After sending a startup message, libpq expects either an errorresponse ('E') or an authentication request ('R'). Before processingthe message, it ensures it has read enough bytes to correspond to thelength specified in the message. However, when processing the 'R'message, if an EOF status is returned it loops back waiting for moreinput, even though we already checked that we have enough input. Inthis particular case, this is probably not reachable anyway, becauseother code ensures we have enough bytes for an authentication requestmessage, but the code is wrong and misleading. In the more generalcase, processing a faulty message could result in an EOF status, whichwould then result in an infinite loop waiting for the end of a messagethat will never come. The correction is to make this an error.Reported-by: Jacob Champion <jchampion@timescale.com>Discussion:https://www.postgresql.org/message-id/flat/f9c7862f-b864-8ef7-a861-c4638c83e209@enterprisedb.com
1 parent3d0c95b commitdce92e5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,8 +3358,7 @@ PQconnectPoll(PGconn *conn)
33583358
/* Get the type of request. */
33593359
if (pqGetInt((int*)&areq,4,conn))
33603360
{
3361-
/* We'll come back when there are more data */
3362-
returnPGRES_POLLING_READING;
3361+
gotoerror_return;
33633362
}
33643363
msgLength-=4;
33653364

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp