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

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Feb 22 15:49:03 UTC 2018


#25055: string_is_valid_hostname() returns true for IPv4 addresses
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.2.1-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  IPv6, IPv4, tor-dns, 032-backport,   |  Actual Points:
  033-must                                       |
Parent ID:  #25036                               |         Points:  1
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by nickm):

 {{{
    size_t len = strlen(string);

 -  tor_assert(string);
 -  tor_assert(len > 0);
 +  if (string == NULL)
 +    return 0;
 +
 +  len = strlen(string);
 }}}

 Looks like you're doing strlen(string) before you check it for NULL, and
 after.

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


More information about the tor-bugs mailing list