[tor-bugs] #4778 [Tor Relay]: Bug in timer{add, sub} compatibility functions

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sun Dec 25 21:44:04 UTC 2011


#4778: Bug in timer{add,sub} compatibility functions
-----------------------+----------------------------------------------------
 Reporter:  asn        |          Owner:                    
     Type:  defect     |         Status:  new               
 Priority:  normal     |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Relay  |        Version:                    
 Keywords:             |         Parent:                    
   Points:             |   Actualpoints:                    
-----------------------+----------------------------------------------------
 {{{
 < Vektor> i have another bugfix for tor
 < Vektor> replace:
 < Vektor> #define timeradd(tv1,tv2,tvout) \
 < Vektor>   do {                                                  \
 < Vektor>     (tvout)->tv_sec = (tv1)->tv_sec + (tv2)->tv_sec;    \
 < Vektor>     (tvout)->tv_usec = (tv2)->tv_usec + (tv2)->tv_usec; \
 < Vektor> with:
 < Vektor> #define timeradd(tv1,tv2,tvout) \
 < Vektor>   do {                                                  \
 < Vektor>     (tvout)->tv_sec = (tv1)->tv_sec + (tv2)->tv_sec;    \
 < Vektor>     (tvout)->tv_usec = (tv1)->tv_usec + (tv2)->tv_usec; \
 < Vektor> and replace:
 < Vektor> #define timersub(tv1,tv2,tvout) \
 < Vektor>   do {                                                  \
 < Vektor>     (tvout)->tv_sec = (tv1)->tv_sec - (tv2)->tv_sec;    \
 < Vektor>     (tvout)->tv_usec = (tv2)->tv_usec - (tv2)->tv_usec; \
 < Vektor> with:
 < Vektor> #define timersub(tv1,tv2,tvout) \
 < Vektor>   do {                                                  \
 < Vektor>     (tvout)->tv_sec = (tv1)->tv_sec - (tv2)->tv_sec;    \
 < Vektor>     (tvout)->tv_usec = (tv1)->tv_usec - (tv2)->tv_usec; \
 }}}

 These definitions are only used in platforms where `timersub` and
 `timeradd` are not defined.

 `timeradd` doesn't seem to be used anywhere in the code, and `timersub`
 only seems to be used in `circuit_expire_building()`.

 At first glance, the issue doesn't seem security related, but we should
 look at it carefully.

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


More information about the tor-bugs mailing list