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

Commita7812eb

Browse files
committed
Fix Windows-only postmaster code to reject a connection request and continue,
rather than elog(FATAL), when there is no more room in ShmemBackendArray.This is a security issue since too many connection requests arriving closetogether could cause the postmaster to shut down, resulting in denial ofservice. Reported by Yoshiyuki Asaba, fixed by Magnus Hagander.
1 parentbf7faa7 commita7812eb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.478 2006/01/05 10:07:45 petere Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.479 2006/01/06 02:58:25 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -147,7 +147,11 @@ typedef struct bkend
147147
staticDllist*BackendList;
148148

149149
#ifdefEXEC_BACKEND
150-
#defineNUM_BACKENDARRAY_ELEMS (2*MaxBackends)
150+
/*
151+
* Number of entries in the backend table. Twice the number of backends,
152+
* plus four other subprocesses (stats, bgwriter, autovac, logger).
153+
*/
154+
#defineNUM_BACKENDARRAY_ELEMS (2*MaxBackends + 4)
151155
staticBackend*ShmemBackendArray;
152156
#endif
153157

@@ -3083,6 +3087,15 @@ internal_forkexec(int argc, char *argv[], Port *port)
30833087
Assert(strncmp(argv[1],"-fork",5)==0);
30843088
Assert(argv[2]==NULL);
30853089

3090+
/* Verify that there is room in the child list */
3091+
if (win32_numChildren >=NUM_BACKENDARRAY_ELEMS)
3092+
{
3093+
elog(LOG,"no room for child entry in backend list");
3094+
/* Report same error as for a fork failure on Unix */
3095+
errno=EAGAIN;
3096+
return-1;
3097+
}
3098+
30863099
/* Set up shared memory for parameter passing */
30873100
ZeroMemory(&sa,sizeof(sa));
30883101
sa.nLength=sizeof(sa);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp