1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

psql: fix startup crash caused by PSQLRC containing a tilde

'strdup' the PSQLRC environment variable value before calling a routine
that might free() it.

Backpatch to 9.2, where the bug first appeared.
This commit is contained in:
Bruce Momjian
2013-04-04 12:56:21 -04:00
parent bf2b0a1478
commit 48a2cd370e
3 changed files with 10 additions and 9 deletions

View File

@@ -1645,11 +1645,11 @@ session_username(void)
* substitute '~' with HOME or '~username' with username's home dir
*
*/
char *
void
expand_tilde(char **filename)
{
if (!filename || !(*filename))
return NULL;
return;
/*
* WIN32 doesn't use tilde expansion for file names. Also, it uses tilde
@@ -1697,5 +1697,5 @@ expand_tilde(char **filename)
}
#endif
return *filename;
return;
}