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

Commitd167fb1

Browse files
committed
Fix sanity-check code that mistakenly assumed error and notice messages
could never exceed 30K. Per report from Andreas Pflug.
1 parent36c9a01 commitd167fb1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.10 2003/11/29 19:52:12 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.11 2003/12/28 17:43:57 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -35,6 +35,15 @@
3535
#endif
3636

3737

38+
/*
39+
* This macro lists the backend message types that could be "long" (more
40+
* than a couple of kilobytes).
41+
*/
42+
#defineVALID_LONG_MESSAGE_TYPE(id) \
43+
((id) == 'T' || (id) == 'D' || (id) == 'd' || (id) == 'V' || \
44+
(id) == 'E' || (id) == 'N' || (id) == 'A')
45+
46+
3847
staticvoidhandleSyncLoss(PGconn*conn,charid,intmsgLength);
3948
staticintgetRowDescriptions(PGconn*conn);
4049
staticintgetAnotherTuple(PGconn*conn,intmsgLength);
@@ -83,8 +92,7 @@ pqParseInput3(PGconn *conn)
8392
handleSyncLoss(conn,id,msgLength);
8493
return;
8594
}
86-
if (msgLength>30000&&
87-
!(id=='T'||id=='D'||id=='d'))
95+
if (msgLength>30000&& !VALID_LONG_MESSAGE_TYPE(id))
8896
{
8997
handleSyncLoss(conn,id,msgLength);
9098
return;
@@ -1257,8 +1265,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
12571265
handleSyncLoss(conn,id,msgLength);
12581266
break;
12591267
}
1260-
if (msgLength>30000&&
1261-
!(id=='T'||id=='D'||id=='d'||id=='V'))
1268+
if (msgLength>30000&& !VALID_LONG_MESSAGE_TYPE(id))
12621269
{
12631270
handleSyncLoss(conn,id,msgLength);
12641271
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp