[or-cvs] backport: Stop dnsworkers from triggering an assert failure...

Roger Dingledine arma at seul.org
Thu Aug 12 06:27:11 UTC 2004


Update of /home2/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/0072/src/common

Modified Files:
      Tag: tor-0_0_7-patches
	util.c 
Log Message:
backport: Stop dnsworkers from triggering an assert failure when you
ask them to resolve the host "".


Index: util.c
===================================================================
RCS file: /home2/or/cvsroot/src/common/util.c,v
retrieving revision 1.106
retrieving revision 1.106.2.1
diff -u -d -r1.106 -r1.106.2.1
--- util.c	5 Jun 2004 01:56:54 -0000	1.106
+++ util.c	12 Aug 2004 06:27:08 -0000	1.106.2.1
@@ -1709,7 +1709,10 @@
   struct in_addr iaddr;
   struct hostent *ent;
   tor_assert(addr);
-  if (tor_inet_aton(name, &iaddr)) {
+  if (!*name) {
+    /* Empty address is an error. */
+    return -1;
+  } else if (tor_inet_aton(name, &iaddr)) {
     /* It's an IP. */
     memcpy(addr, &iaddr.s_addr, 4);
     return 0;



More information about the tor-commits mailing list