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

Commitf81ce4a

Browse files
committed
Prevent problem with extra-long password packets from allocating lots of
memory.Neil Conway
1 parent626eca6 commitf81ce4a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/backend/libpq/auth.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.86 2002/08/2903:22:01 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.87 2002/08/2921: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
returnSTATUS_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+
returnSTATUS_EOF;
724+
}
725+
712726
initStringInfo(&buf);
713727
if (pq_getstr(&buf)==EOF)/* receive password */
714728
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp