diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-28 17:44:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-28 17:44:05 +0000 |
commit | 9c08d8fe56faa4d78079c7aa621a477c8d710453 (patch) | |
tree | bfde066c2f4adbc2b59826c2e113e8e4e1ec9276 /src/interfaces/libpq/fe-protocol3.c | |
parent | 2315548ed7a8dda84316f325eb633c6f0c09b842 (diff) | |
download | postgresql-9c08d8fe56faa4d78079c7aa621a477c8d710453.tar.gz postgresql-9c08d8fe56faa4d78079c7aa621a477c8d710453.zip |
Fix sanity-check code that mistakenly assumed error and notice messages
could never exceed 30K. Per report from Andreas Pflug.
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index ba06a37848f..690bef2e9cf 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.9 2003/08/27 00:33:34 petere Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.9.2.1 2003/12/28 17:44:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,6 +35,15 @@ #endif +/* + * This macro lists the backend message types that could be "long" (more + * than a couple of kilobytes). + */ +#define VALID_LONG_MESSAGE_TYPE(id) \ + ((id) == 'T' || (id) == 'D' || (id) == 'd' || (id) == 'V' || \ + (id) == 'E' || (id) == 'N' || (id) == 'A') + + static void handleSyncLoss(PGconn *conn, char id, int msgLength); static int getRowDescriptions(PGconn *conn); static int getAnotherTuple(PGconn *conn, int msgLength); @@ -83,8 +92,7 @@ pqParseInput3(PGconn *conn) handleSyncLoss(conn, id, msgLength); return; } - if (msgLength > 30000 && - !(id == 'T' || id == 'D' || id == 'd')) + if (msgLength > 30000 && !VALID_LONG_MESSAGE_TYPE(id)) { handleSyncLoss(conn, id, msgLength); return; @@ -1257,8 +1265,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid, handleSyncLoss(conn, id, msgLength); break; } - if (msgLength > 30000 && - !(id == 'T' || id == 'D' || id == 'd' || id == 'V')) + if (msgLength > 30000 && !VALID_LONG_MESSAGE_TYPE(id)) { handleSyncLoss(conn, id, msgLength); break; |