[tor-bugs] #19167 [Core Tor/Tor]: torrc parsing b0rks on carriage-return

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue May 24 23:14:19 UTC 2016


#19167: torrc parsing b0rks on carriage-return
------------------------------+--------------------------
     Reporter:  cypherpunks   |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:
    Component:  Core Tor/Tor  |    Version:  Tor: 0.2.7.6
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------
 Windows still terminates text files with '\r\n' by default, this seems to
 break the handling of quoted values in torrc.

 https://gitweb.torproject.org/tor.git/tree/src/common/util.c#n2899

 It consumes the quoted string, then consumes any trailing whitespace (tabs
 or spaces), then it expects either a comment '#' or an '\n'. However if a
 file edited through notepad.exe for example, the first character it
 encounters would be '\r', preceding the '\n'.

 This results in tor throwing: "[warn] Error while parsing configuration:
 Excess data after quoted string" then erroring out.

 Testing on 0.2.7.6.

 Steps to reproduce:

 `$ printf "SocksPort 54321\nDataDirectory \"/tmp/datadir\"\r\n" >
 /tmp/conf`
 `$ tor -f /tmp/conf`
 `...[notice] Tor v0.2.7.6 (git-605ae665009853bd) running on Linux with
 Libevent 2.0.21-stable, OpenSSL 1.0.2h and Zlib 1.2.8`
 `...[notice] Tor can't help you if you use it wrong! Learn how to be safe
 at https://www.torproject.org/download/download#warning`
 `...[notice] Read configuration file "/tmp/conf".`
 `...[warn] Error while parsing configuration: Excess data after quoted
 string`
 `...[err] Reading config failed--see warnings above.`
 `$`

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


More information about the tor-bugs mailing list