1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

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.
This commit is contained in:
Bruce Momjian
2012-12-20 13:56:24 -05:00
parent af275a12df
commit dc9896a245
3 changed files with 27 additions and 17 deletions

View File

@ -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;