postgres.git / summary / log / commit / refs
commit 48da2b87e3f292534a26d3bacc2a13f7b62a34c8
Author: Bruce Momjian <bruce@momjian.us>
Date: Thu Dec 16 15:13:43 2010 +0000
First released in: 9.1.0
Fix crash caused by NULL lookup when reporting IP address of failed
libpq connection, per report from Magnus. This happens only on GIT
master and only on Win32 because that is the platform where "" maps to
an IP address (localhost).
src/interfaces/libpq/fe-connect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index b1523a6a893..8d9400be0fc 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -1031,7 +1031,8 @@ connectFailureMessage(PGconn *conn, int errorno)
strcpy(host_addr, "???");
display_host_addr = (conn->pghostaddr == NULL) &&
- (strcmp(conn->pghost, host_addr) != 0);
+ (conn->pghost != NULL) &&
+ (strcmp(conn->pghost, host_addr) != 0);
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not connect to server: %s\n"
[parent: 5cdd65f3241c]