[tor-bugs] #4971 [Tor Client]: Provide initvalue in GETINFO config/names

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon Apr 2 15:28:05 UTC 2012


#4971: Provide initvalue in GETINFO config/names
-------------------------+--------------------------------------------------
 Reporter:  chiiph       |          Owner:                    
     Type:  enhancement  |         Status:  needs_revision    
 Priority:  normal       |      Milestone:  Tor: 0.2.4.x-final
Component:  Tor Client   |        Version:                    
 Keywords:               |         Parent:                    
   Points:               |   Actualpoints:                    
-------------------------+--------------------------------------------------
Changes (by rransom):

  * status:  needs_review => needs_revision


Comment:

 From the documentation comment on `esc_for_log` in src/or/util.c:
 {{{
 /** Allocate and return a new string representing the contents of
 <b>s</b>,
  * surrounded by quotes and using standard C escapes.
 }}}
 So your branch leaks `initvalue`.

 There are at least three ways to avoid freeing the constant string
 `"NULL"`.  One is to `tor_strdup` it in an `else `clause.  Another is to
 use the `tor_strdup("(null)")` which `esc_for_log` returns if its argument
 is `NULL` as your representation of a `NULL` `initvalue`.  Another is to
 stick a second copy of the pointer which `esc_for_log` returns into
 another variable which can always be passed to `tor_free` (because it
 always holds a pointer to a temporary object or `NULL`).


 Does anything else parse the output of `GETINFO config/names`?  Does
 control-spec.txt specify its output format?


 Other than that, the code change looks good.

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


More information about the tor-bugs mailing list