[tor-commits] [torsocks/master] Fix segfault

hoganrobert at torproject.org hoganrobert at torproject.org
Sun Feb 20 14:04:15 UTC 2011


commit d8c11fa185dbcb4ea448394670b70f51e6cd786c
Author: Robert Hogan <robert at roberthogan.net>
Date:   Sun Feb 20 13:52:59 2011 +0000

    Fix segfault
    
    Occurred when tor not running, torsocks run in debug/test mode, and
    gethostbyaddr() fails.
---
 src/dead_pool.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dead_pool.c b/src/dead_pool.c
index 0ef0d30..13e5740 100644
--- a/src/dead_pool.c
+++ b/src/dead_pool.c
@@ -590,8 +590,9 @@ our_gethostbyaddr(dead_pool *pool, const void *_addr, socklen_t len, int type)
   he.h_addrtype  = type;
   he.h_addr_list = addrs;
 
-  show_msg(MSGTEST, "our_gethostbyaddr: resolved '%s' to: '%s'\n",
-           inet_ntoa(*((struct in_addr *)he.h_addr)), result_hostname);
+  if (result_hostname)
+      show_msg(MSGTEST, "our_gethostbyaddr: resolved '%s' to: '%s'\n",
+              inet_ntoa(*((struct in_addr *)he.h_addr)), result_hostname);
 
   return &he;
 



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



More information about the tor-commits mailing list