[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 5636ed0f84981b14f61e8ff562e33d444e1aba28
Author: David Goulet <dgoulet@xxxxxxxxx>
Date:   Tue Mar 4 17:07:58 2014 -0500

    Fix: handle NULL node in getaddrinfo
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
 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;
 	}
 
 	/*



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits