From dc9896a2457f0d72458f1ff45935362521f0f99c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 20 Dec 2012 13:56:24 -0500 Subject: Avoid using NAMEDATALEN in pg_upgrade Because the client encoding might not match the server encoding, pg_upgrade can't allocate NAMEDATALEN bytes for storage of database, relation, and namespace identifiers. Instead pg_strdup() the memory and free it. Also add C comment in initdb.c about safe NAMEDATALEN usage. --- src/bin/initdb/initdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 40740dcb723..3e05ac3309f 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1836,7 +1836,7 @@ setup_collation(void) #if defined(HAVE_LOCALE_T) && !defined(WIN32) int i; FILE *locale_a_handle; - char localebuf[NAMEDATALEN]; + char localebuf[NAMEDATALEN]; /* we assume ASCII so this is fine */ int count = 0; PG_CMD_DECL; -- cgit v1.2.3