[tor-bugs] #26348 [Circumvention/Snowflake]: Guard against large reads

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue May 28 18:12:39 UTC 2019


#26348: Guard against large reads
-----------------------------------------------+---------------------------
 Reporter:  dcf                                |          Owner:  cohosh
     Type:  defect                             |         Status:  closed
 Priority:  Medium                             |      Milestone:
Component:  Circumvention/Snowflake            |        Version:
 Severity:  Normal                             |     Resolution:  fixed
 Keywords:  easy anti-censorship-roadmap-2019  |  Actual Points:
Parent ID:                                     |         Points:  1
 Reviewer:                                     |        Sponsor:  Sponsor19
-----------------------------------------------+---------------------------
Changes (by cohosh):

 * status:  merge_ready => closed
 * resolution:   => fixed


Comment:

 Replying to [comment:9 dcf]:
 > Okay, this looks fine to me.
 >
 > I thought of a potentially better way to write `limitedRead`: pass
 `limit+1` bytes to `io.LimitedReader`, and then return an error if either
 `io.ReadAll` returns an error, or `len(p) == limit+1`. Basically, roll the
 second read of 1 byte into the original read. If that works and it looks
 better to you, that's good to merge as well.

 Ah that looks a lot nicer. I went with this, and also made a small change
 to get the CI to pass: https://github.com/cohosh/snowflake/pull/2

 It's been merged to master

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


More information about the tor-bugs mailing list