[tor-commits] [torsocks/master] Fix: handle NULL node in getaddrinfo

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014


commit 5636ed0f84981b14f61e8ff562e33d444e1aba28
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Tue Mar 4 17:07:58 2014 -0500

    Fix: handle NULL node in getaddrinfo
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/lib/getaddrinfo.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/getaddrinfo.c b/src/lib/getaddrinfo.c
index 003e51f..378f87f 100644
--- a/src/lib/getaddrinfo.c
+++ b/src/lib/getaddrinfo.c
@@ -44,8 +44,13 @@ LIBC_GETADDRINFO_RET_TYPE tsocks_getaddrinfo(LIBC_GETADDRINFO_SIG)
 	DBG("[getaddrinfo] Requesting %s hostname", node);
 
 	if (!node) {
-		ret = EAI_NONAME;
-		goto error;
+		/*
+		 * As stated in the man page, if node is NULL, the libc call will
+		 * return a valid socket address but NO external DNS resolution is
+		 * possible since there is no host name to resolve.
+		 */
+		tmp_node = node;
+		goto libc_call;
 	}
 
 	/*





More information about the tor-commits mailing list