[tor-bugs] #25055 [Core Tor/Tor]: string_is_valid_hostname() returns true for IPv4 addresses

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Feb 5 19:57:55 UTC 2018


#25055: string_is_valid_hostname() returns true for IPv4 addresses
-------------------------------+------------------------------------
 Reporter:  teor               |          Owner:  (none)
     Type:  defect             |         Status:  new
 Priority:  Medium             |      Milestone:  Tor: 0.3.4.x-final
Component:  Core Tor/Tor       |        Version:
 Severity:  Normal             |     Resolution:
 Keywords:  IPv6 IPv4 tor-dns  |  Actual Points:
Parent ID:                     |         Points:  1
 Reviewer:                     |        Sponsor:
-------------------------------+------------------------------------

Comment (by dgoulet):

 Replying to [comment:1 arma]:
 > It is meant to return true for everything that exits will let you (try
 to) connect to.
 >
 > Maybe that means changing the word "hostname" to a word that doesn't
 make some people think it can't be an IP address.

 Hmmm the way I understand it on how it is used in the code, it can *not*
 take an IP address. It has to be a DNS name. Also, every unit tests for
 this function is testing for a name, never an address.

 >
 > It also sounds like allowing ipv6 addresses is the right thing to do.

 So this function is doing what it should imo except returning true for an
 IPv4. One simple test would be to pass the value through `inet_pton` and
 if it returns -1, we know we do *not* have an IP address?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25055#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list