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

Commit18b5835

Browse files
committed
Be sure length limit passed to snprintf matches what malloc was given.
Just paranoia ...
1 parent37d6930 commit18b5835

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.45 2004/11/04 22:25:12 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.46 2004/11/17 16:34:42 tgl Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1284,7 +1284,7 @@ main(int argc, char **argv)
12841284

12851285
strcpy(pgdata_D,optarg);
12861286
canonicalize_path(pgdata_D);
1287-
snprintf(env_var,strlen(pgdata_D)+8,"PGDATA=%s",
1287+
snprintf(env_var,strlen(optarg)+8,"PGDATA=%s",
12881288
pgdata_D);
12891289
putenv(env_var);
12901290

@@ -1294,7 +1294,8 @@ main(int argc, char **argv)
12941294
*postmaster 'ps' display
12951295
*/
12961296
pgdata_opt=xmalloc(strlen(pgdata_D)+7);
1297-
snprintf(pgdata_opt,strlen(pgdata_D)+7,"-D \"%s\" ",
1297+
snprintf(pgdata_opt,strlen(pgdata_D)+7,
1298+
"-D \"%s\" ",
12981299
pgdata_D);
12991300
break;
13001301
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp