[or-cvs] Fix bug reported by peter palfrader: an empty address is un...
Nick Mathewson
nickm at seul.org
Tue Jul 6 23:25:23 UTC 2004
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv5571/src/common
Modified Files:
util.c
Log Message:
Fix bug reported by peter palfrader: an empty address is unresolvable, but not an occasion for an assertion failure in a dnsworker.
Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- util.c 30 Jun 2004 16:37:08 -0000 1.108
+++ util.c 6 Jul 2004 23:25:20 -0000 1.109
@@ -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;
+ } 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