[tor-bugs] #21280 [Core Tor/Tor]: tor-resolve: Do not truncate too long hostnames

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Jan 23 19:03:06 UTC 2017


#21280: tor-resolve: Do not truncate too long hostnames
-------------------------------------------------+-------------------------
 Reporter:  junglefowl                           |          Owner:
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.0.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.9.8
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-resolve, security-review,        |  Actual Points:
  029-backport                                   |
Parent ID:                                       |         Points:  0.5
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by junglefowl):

 addrlen is already increased by 1 to contain the ending \0 character in
 the string. When its value is assigned to the unsigned char in the data
 packet, it is subtracted by one:

 (*out)[ 4 ] = (char)(uint8_t)(addrlen - 1);

 Due to this, i chose to cap at addrlen > 256 because 256-1=255 can still
 be properly put into the length byte. The ending \0 is not needed in the
 protocol, otherwise google.commm[...] would have been parsed by the remote
 peer.

 I could reduce the constant to 255. As yawning pointed out, the DNS lookup
 of the remote peer would fail anyway, but I prefer to support as much as
 the SOCKS5 protocol offers.

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


More information about the tor-bugs mailing list