aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-11-17 16:34:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-11-17 16:34:42 +0000
commit18b58350dbb36b5e23c8b1d6852a058d0a4eceaf (patch)
tree3e9f63f5fd61f92705728ab426056f1b29ebd4fd /src
parent37d693033d961cf96bbbc327a9894403454911a7 (diff)
downloadpostgresql-18b58350dbb36b5e23c8b1d6852a058d0a4eceaf.tar.gz
postgresql-18b58350dbb36b5e23c8b1d6852a058d0a4eceaf.zip
Be sure length limit passed to snprintf matches what malloc was given.
Just paranoia ...
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/pg_ctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index ed78587a49c..b5379ae0e79 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.45 2004/11/04 22:25:12 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.46 2004/11/17 16:34:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1284,7 +1284,7 @@ main(int argc, char **argv)
strcpy(pgdata_D, optarg);
canonicalize_path(pgdata_D);
- snprintf(env_var, strlen(pgdata_D) + 8, "PGDATA=%s",
+ snprintf(env_var, strlen(optarg) + 8, "PGDATA=%s",
pgdata_D);
putenv(env_var);
@@ -1294,7 +1294,8 @@ main(int argc, char **argv)
* postmaster 'ps' display
*/
pgdata_opt = xmalloc(strlen(pgdata_D) + 7);
- snprintf(pgdata_opt, strlen(pgdata_D) + 7, "-D \"%s\" ",
+ snprintf(pgdata_opt, strlen(pgdata_D) + 7,
+ "-D \"%s\" ",
pgdata_D);
break;
}