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

Commitd31ff14

Browse files
committed
Fix memory overrun while setting ps status
1 parent18c3000 commitd31ff14

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

‎src/backend/utils/init/globals.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.38 1999/10/08 04:28:48 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.39 1999/12/10 10:29:01 ishii Exp $
1111
*
1212
* NOTES
1313
* Globals used all over the place should be declared here and not
@@ -88,6 +88,13 @@ char *IndexedCatalogNames[] = {
8888
};
8989

9090

91+
/*
92+
* ps status buffer
93+
*/
94+
#ifndeflinux
95+
charPs_status_buffer[1024];
96+
#endif
97+
9198
/* ----------------
9299
* we just do a linear search now so there's no requirement that the list
93100
* be ordered.The list is so small it shouldn't make much difference.

‎src/include/utils/ps_status.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ char *ps_status_buffer = NULL
4848

4949
#else/* !linux */
5050

51-
externconstchar**ps_status;
51+
externcharPs_status_buffer[];
5252

53-
#definePS_DEFINE_BUFFER \
54-
const char **ps_status = NULL
53+
#definePS_DEFINE_BUFFER
5554

5655
#definePS_INIT_STATUS(argc,argv,execname,username,hostname,dbname) \
5756
{ \
@@ -61,18 +60,18 @@ const char **ps_status = NULL
6160
argv[1] = hostname; \
6261
argv[2] = username; \
6362
argv[3] = dbname; \
64-
ps_status = (const char **)&argv[4]; \
65-
for (i =4; i < argc; i++) \
63+
argv[4] = Ps_status_buffer; \
64+
for (i =5; i < argc; i++) \
6665
argv[i] = "";/* blank them */ \
6766
}
6867

6968
#definePS_CLEAR_STATUS() \
70-
{if (ps_status) *ps_status = ""; }
69+
{Ps_status_buffer[0] = '\0'; }
7170

7271
#definePS_SET_STATUS(status) \
73-
{if (ps_status) *ps_status =(status); }
72+
{strcpy(Ps_status_buffer,(status)); }
7473

75-
#definePS_STATUS (ps_status ? *ps_status : "")
74+
#definePS_STATUS (Ps_status_buffer)
7675
#endif
7776

7877
#ifdefNO_PS_STATUS

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp