diff -urN postgresql-9.1.2/src/bin/psql/command.c postgresql-9.1.2.new/src/bin/psql/command.c
--- postgresql-9.1.2/src/bin/psql/command.c	2011-12-01 16:47:20.000000000 -0500
+++ postgresql-9.1.2.new/src/bin/psql/command.c	2012-01-28 09:12:21.170981570 -0500
@@ -905,8 +905,8 @@
 		char	   *pw1;
 		char	   *pw2;
 
-		pw1 = simple_prompt("Enter new password: ", 100, false);
-		pw2 = simple_prompt("Enter it again: ", 100, false);
+		pw1 = simple_prompt("Enter new password: ", PASSWDLEN, false);
+		pw2 = simple_prompt("Enter it again: ", PASSWDLEN, false);
 
 		if (strcmp(pw1, pw2) != 0)
 		{
@@ -1424,15 +1424,15 @@
 	char	   *result;
 
 	if (username == NULL)
-		result = simple_prompt("Password: ", 100, false);
+		result = simple_prompt("Password: ", PASSWDLEN, false);
 	else
 	{
 		char	   *prompt_text;
 
-		prompt_text = malloc(strlen(username) + 100);
-		snprintf(prompt_text, strlen(username) + 100,
+		prompt_text = malloc(strlen(username) + PASSWDLEN);
+		snprintf(prompt_text, strlen(username) + PASSWDLEN,
 				 _("Password for user %s: "), username);
-		result = simple_prompt(prompt_text, 100, false);
+		result = simple_prompt(prompt_text, PASSWDLEN, false);
 		free(prompt_text);
 	}
 
diff -urN postgresql-9.1.2/src/include/pg_config_manual.h postgresql-9.1.2.new/src/include/pg_config_manual.h
--- postgresql-9.1.2/src/include/pg_config_manual.h	2011-12-01 16:47:20.000000000 -0500
+++ postgresql-9.1.2.new/src/include/pg_config_manual.h	2012-01-28 09:09:44.461992286 -0500
@@ -19,6 +19,8 @@
  */
 #define NAMEDATALEN 64
 
+#define PASSWDLEN 1024
+
 /*
  * Maximum number of arguments to a function.
  *
diff -urN postgresql-9.1.2/src/interfaces/libpq/fe-connect.c postgresql-9.1.2.new/src/interfaces/libpq/fe-connect.c
--- postgresql-9.1.2/src/interfaces/libpq/fe-connect.c	2011-12-01 16:47:20.000000000 -0500
+++ postgresql-9.1.2.new/src/interfaces/libpq/fe-connect.c	2012-01-28 09:13:02.817978722 -0500
@@ -4836,7 +4836,7 @@
 	char		pgpassfile[MAXPGPATH];
 	struct stat stat_buf;
 
-#define LINELEN NAMEDATALEN*5
+#define LINELEN NAMEDATALEN*4+PASSWDLEN
 	char		buf[LINELEN];
 
 	if (dbname == NULL || strlen(dbname) == 0)
--- postgresql-9.1.2/src/bin/psql/startup.c	2011-12-01 16:47:20.000000000 -0500
+++ postgresql-9.1.2.new/src/bin/psql/startup.c	2012-01-28 09:51:02.135822862 -0500
@@ -166,7 +166,7 @@
 	}
 
 	if (pset.getPassword == TRI_YES)
-		password = simple_prompt(password_prompt, 100, false);
+		password = simple_prompt(password_prompt, PASSWDLEN, false);
 
 	/* loop until we have a password if requested by backend */
 	do
@@ -205,7 +205,7 @@
 			pset.getPassword != TRI_NO)
 		{
 			PQfinish(pset.db);
-			password = simple_prompt(password_prompt, 100, false);
+			password = simple_prompt(password_prompt, PASSWDLEN, false);
 			new_pass = true;
 		}
 	} while (new_pass);
--- postgresql-9.1.2/src/bin/initdb/initdb.c	2011-12-01 16:47:20.000000000 -0500
+++ postgresql-9.1.2.new/src/bin/initdb/initdb.c	2012-01-28 10:54:48.600561210 -0500
@@ -1280,7 +1280,7 @@
 		 * for now.
 		 */
 		FILE	   *pwf = fopen(pwfilename, "r");
-		char		pwdbuf[MAXPGPATH];
+		char		pwdbuf[PASSWDLEN];
 		int			i;
 
 		if (!pwf)
