aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2010-12-16 10:13:43 -0500
committerBruce Momjian <bruce@momjian.us>2010-12-16 10:13:43 -0500
commit48da2b87e3f292534a26d3bacc2a13f7b62a34c8 (patch)
tree3e9ebadbc471e93dd7621c911d97f4d9a646e5e7
parent5cdd65f3241ce10c66953228daef60df7b3966d1 (diff)
downloadpostgresql-48da2b87e3f292534a26d3bacc2a13f7b62a34c8.tar.gz
postgresql-48da2b87e3f292534a26d3bacc2a13f7b62a34c8.zip
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).
-rw-r--r--src/interfaces/libpq/fe-connect.c3
1 files changed, 2 insertions, 1 deletions
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"