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

Commit3cb282f

Browse files
committed
Guard against array overrun, per report from Yichen Xie. This case
can only occur if the constant DEFAULT_CLIENT_AUTHSVC is given a bogusvalue, so it doesn't seem worth back-patching, but I'll fix it in HEAD.
1 parent23b8a0c commit3cb282f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.72 2002/12/03 22:09:20 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.73 2003/01/29 01:18:21 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -686,7 +686,14 @@ MsgType
686686
fe_getauthsvc(char*PQerrormsg)
687687
{
688688
if (pg_authsvc<0||pg_authsvc >=n_authsvcs)
689+
{
689690
fe_setauthsvc(DEFAULT_CLIENT_AUTHSVC,PQerrormsg);
691+
if (pg_authsvc<0||pg_authsvc >=n_authsvcs)
692+
{
693+
/* Can only get here if DEFAULT_CLIENT_AUTHSVC is misdefined */
694+
return0;
695+
}
696+
}
690697
returnauthsvcs[pg_authsvc].msgtype;
691698
}
692699

@@ -704,6 +711,10 @@ fe_getauthname(char *PQerrormsg)
704711

705712
authsvc=fe_getauthsvc(PQerrormsg);
706713

714+
/* this just guards against broken DEFAULT_CLIENT_AUTHSVC, see above */
715+
if (authsvc==0)
716+
returnNULL;/* leave original error message in place */
717+
707718
#ifdefKRB4
708719
if (authsvc==STARTUP_KRB4_MSG)
709720
name=pg_krb4_authname(PQerrormsg);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp