Skip to content

Commit 2ce964b

Browse files
committed
Ensure getaddrinfo_all returns null result on failure.
1 parent e295c55 commit 2ce964b

File tree

1 file changed

+5
-2
lines changed
  • src/backend/libpq

1 file changed

+5
-2
lines changed

src/backend/libpq/ip.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.24 2003/11/29 19:51:49 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.25 2004/04/24 20:10:34 tgl Exp $
1212
*
1313
* This file and the IPV6 implementation were initially provided by
1414
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -67,8 +67,11 @@ static int getnameinfo_unix(const struct sockaddr_un * sa, int salen,
6767
*/
6868
int
6969
getaddrinfo_all(const char *hostname, const char *servname,
70-
const struct addrinfo * hintp, struct addrinfo ** result)
70+
const struct addrinfo *hintp, struct addrinfo **result)
7171
{
72+
/* not all versions of getaddrinfo() zero *result on failure */
73+
*result = NULL;
74+
7275
#ifdef HAVE_UNIX_SOCKETS
7376
if (hintp != NULL && hintp->ai_family == AF_UNIX)
7477
return getaddrinfo_unix(servname, hintp, result);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy