summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/libpq-int.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/libpq-int.h')
-rw-r--r--src/interfaces/libpq/libpq-int.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 02c114f1405..0f3661b8889 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -563,7 +563,16 @@ struct pg_conn
pg_prng_state prng_state; /* prng state for load balancing connections */
- /* Buffer for data received from backend and not yet processed */
+ /*
+ * Buffer for data received from backend and not yet processed.
+ *
+ * NB: We rely on a maximum inBufSize/outBufSize of INT_MAX (and therefore
+ * an INT_MAX upper bound on the size of any and all packet contents) to
+ * avoid overflow; for example in reportErrorPosition(). Changing the type
+ * would require not only an adjustment to the overflow protection in
+ * pqCheck{In,Out}BufferSpace(), but also a careful audit of all libpq
+ * code that uses ints during size calculations.
+ */
char *inBuffer; /* currently allocated buffer */
int inBufSize; /* allocated size of buffer */
int inStart; /* offset to first unconsumed data in buffer */