[tor-bugs] #6044 [Tor Hidden Services]: Tor can't use a named pipe for a hidden service key
    Tor Bug Tracker & Wiki 
    torproject-admin at torproject.org
       
    Thu Sep 13 15:01:56 UTC 2012
    
    
  
#6044: Tor can't use a named pipe for a hidden service key
---------------------------------+------------------------------------------
 Reporter:  katmagic             |          Owner:                    
     Type:  defect               |         Status:  needs_revision    
 Priority:  normal               |      Milestone:  Tor: 0.2.4.x-final
Component:  Tor Hidden Services  |        Version:                    
 Keywords:                       |         Parent:                    
   Points:                       |   Actualpoints:                    
---------------------------------+------------------------------------------
Changes (by nickm):
  * status:  needs_review => needs_revision
  * milestone:  => Tor: 0.2.4.x-final
Comment:
 Reviewing...
 The memcpy seems unnecessary; you should be able to just read() into the
 string directly.
 Reallocing the string every 256 bytes will give bad performance with some
 allocators; generally you want to reallocate on a schedule that gives you
 O(lg n) reallocs
 Those last two won't actually matter in practice for the fifos you'd want
 to use this on; they're just QOI issues.
 I'm a little worried about huge broken fifos running us out of RAM; maybe
 this should have an upper bound as an argument?
 Make sure that it builds when you pass "--enable-gcc-warnings" to the
 compiler.
 "char *string = 0;" should be "char *string = NULL;"
 This function fails badly on a 0-byte fifo: it'll never allocate the
 string, but it'll call string[0] = '\0' anyway.
 The test at the end of the loop is pointless; it can never be false.
 Instead you can just use while(1).
 I think perhaps the function name wants to be different; it's not FIFO-
 specific, it's for anything where you want to read until you hit an EOF.
 For making a file in the unit tests, you can use get_fname().
 The unit test should probably be coded such that it tests the case that
 that goes through the loop just once, more than once, and not at all.
-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6044#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
    
    
More information about the tor-bugs
mailing list