Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5dfd506

Browse files
committed
Defend against overrun of ExtraOptions array --- strictly paranoia,
since the person or script starting the postmaster has to be trusted anyway.
1 parent 99b225c commit 5dfd506

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 3 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.405 2004/06/24 21:02:55 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.406 2004/07/10 23:29:16 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -450,8 +450,9 @@ PostmasterMain(int argc, char *argv[])
450450
/*
451451
* Other options to pass to the backend on the command line
452452
*/
453-
strcat(ExtraOptions, " ");
454-
strcat(ExtraOptions, optarg);
453+
snprintf(ExtraOptions + strlen(ExtraOptions),
454+
sizeof(ExtraOptions) - strlen(ExtraOptions),
455+
" %s", optarg);
455456
break;
456457
case 'p':
457458
SetConfigOption("port", optarg, PGC_POSTMASTER, PGC_S_ARGV);

0 commit comments

Comments
 (0)