File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.86 2002/08/29 03:22:01 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.87 2002/08/29 21:50:36 momjian Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -709,6 +709,20 @@ recv_and_check_password_packet(Port *port)
709709 if (pq_eof () == EOF || pq_getint (& len , 4 ) == EOF )
710710 return STATUS_EOF ; /* client didn't want to send password */
711711
712+ /*
713+ * Since the remote client has not yet been authenticated, we need
714+ * to be careful when using the data they send us. The 8K limit is
715+ * arbitrary, and somewhat bogus: the intent is to ensure we don't
716+ * allocate an enormous chunk of memory.
717+ */
718+
719+ if (len < 1 || len > 8192 )
720+ {
721+ elog (LOG , "Invalid password packet length: %d; "
722+ "must satisfy 1 <= length <= 8192" , len );
723+ return STATUS_EOF ;
724+ }
725+
712726 initStringInfo (& buf );
713727 if (pq_getstr (& buf ) == EOF ) /* receive password */
714728 {
You can’t perform that action at this time.
0 commit comments