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

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Sep 26 21:38:00 UTC 2016


#19167: torrc parsing b0rks on carriage-return
-------------------------------------+------------------------------------
 Reporter:  cypherpunks              |          Owner:
     Type:  defect                   |         Status:  new
 Priority:  Medium                   |      Milestone:  Tor: 0.3.0.x-final
Component:  Core Tor/Tor             |        Version:  Tor: 0.2.7.6
 Severity:  Normal                   |     Resolution:
 Keywords:  windows crlf lorax easy  |  Actual Points:
Parent ID:                           |         Points:
 Reviewer:                           |        Sponsor:
-------------------------------------+------------------------------------

Comment (by pingl):

 I've added a check in `parse_config_line_from_str_verbose`: if `\r` is
 followed by `\n` then `++line` is applied before checking if the newline
 is reached. This seems to fix the reported bug:

 `$ printf "SocksPort 54321\nDataDirectory \"/tmp/datadir\"\r\n" >
 /tmp/conf`
 `$ ./tor -f /tmp/conf`
 `Sep 26 23:34:16.578 [notice] Tor 0.2.9.3-alpha-dev (git-b5b8d620a2e04498)
 running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.2h and Zlib
 1.2.5.`
 `Sep 26 23:34:16.578 [notice] Tor can't help you if you use it wrong!
 Learn how to be safe at
 https://www.torproject.org/download/download#warning`
 `Sep 26 23:34:16.578 [notice] This version is not a stable Tor release.
 Expect more bugs than usual.`
 `Sep 26 23:34:16.579 [notice] Read configuration file "/tmp/conf".`
 `Sep 26 23:34:16.582 [notice] Opening Socks listener on 127.0.0.1:54321`
 `Sep 26 23:34:16.000 [notice] Bootstrapped 0%: Starting`
 `Sep 26 23:34:17.000 [notice] Bootstrapped 5%: Connecting to directory
 server`
 `Sep 26 23:34:17.000 [notice] Bootstrapped 10%: Finishing handshake with
 directory server`
 `Sep 26 23:34:17.000 [notice] Bootstrapped 15%: Establishing an encrypted
 directory connection`
 `Sep 26 23:34:17.000 [notice] Bootstrapped 20%: Asking for networkstatus
 consensus`
 `Sep 26 23:34:17.000 [notice] Bootstrapped 25%: Loading networkstatus
 consensus`
 `Sep 26 23:34:18.000 [notice] I learned some more directory information,
 but not enough to build a circuit: We have no usable consensus.`
 `Sep 26 23:34:19.000 [notice] Bootstrapped 40%: Loading authority key
 certs`
 `Sep 26 23:34:19.000 [notice] Bootstrapped 45%: Asking for relay
 descriptors`


 Here it is the commit link

 https://github.com/aigna/tor/tree/bug19167

 I'm quite new to tor, is there some documentation about how the code is
 structured or at least the philosophy behind the code structure? It would
 be very helpful in order to learn how everything is implemented.

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


More information about the tor-bugs mailing list