Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 289c1e2

Browse files
author
Commitfest Bot
committed
[CF 5749] Fix PQport to never return NULL if the connection is valid
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5749 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/CA+mi_8aaQdULFYo6jDtG+aUzfNmyuitrqNAhx_N_BrCu-beeCw@mail.gmail.com Author(s): Daniele Varrazzo
2 parents e050af2 + a47ed54 commit 289c1e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7536,7 +7536,9 @@ PQport(const PGconn *conn)
75367536
if (!conn)
75377537
return NULL;
75387538

7539-
if (conn->connhost != NULL)
7539+
if (conn->connhost != NULL &&
7540+
conn->connhost[conn->whichhost].port != NULL &&
7541+
conn->connhost[conn->whichhost].port[0] != '\0')
75407542
return conn->connhost[conn->whichhost].port;
75417543

75427544
return "";

0 commit comments

Comments
 (0)