Skip to content

Commit 18b5835

Browse files
committed
Be sure length limit passed to snprintf matches what malloc was given.
Just paranoia ...
1 parent 37d6930 commit 18b5835

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy