[tor-bugs] #4889 [Tor Client]: Cleanup: use smartlist_add_asprintf() rather than tor_asprintf+smartlist_add()

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Thu Jan 12 09:09:17 UTC 2012


#4889: Cleanup: use smartlist_add_asprintf() rather than
tor_asprintf+smartlist_add()
------------------------+---------------------------------------------------
 Reporter:  nickm       |          Owner:                    
     Type:  defect      |         Status:  needs_review      
 Priority:  normal      |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Client  |        Version:                    
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------

Comment(by rransom):

 Replying to [comment:2 nickm]:
 > Renamed the function, and did a big pile of cleanups in branch
 "bug4889".

 Looks good!

 > It's a little long, but the changes are all local and straightforward.
 The biggest thing to watch out for would be some case where we did
 >
 {{{
   len = very big thing
   x = tor_malloc(len);
   tor_snprintf(x,len,"foo%s%s...",...);
   append more stuff to x;
 }}}
 > and I accidentally replaced it with
 {{{
   tor_asprintf(&x, "foo%s%s...",...);
   append morestuff to x;
 }}}
 >
 > But I think I avoided all those cases.

 I didn't see any of those.  The scariest part of this branch to me is the
 part of commit 8a7f46e1fe5e867cd0f8c7d24f4a7b66ede1a94a in
 `policy_summarize` (src/or/policies.c), which needs careful re-review.

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


More information about the tor-bugs mailing list