[tor-bugs] #7192 [Tor]: parsing exit policy summary drops last character

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon Oct 22 21:13:56 UTC 2012


#7192: parsing exit policy summary drops last character
------------------------+---------------------------------------------------
 Reporter:  arma        |          Owner:                    
     Type:  defect      |         Status:  new               
 Priority:  major       |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor         |        Version:  Tor: 0.2.3.23-rc  
 Keywords:  tor-client  |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------

Comment(by arma):

 This resolves the issue:
 {{{
 diff --git a/src/or/policies.c b/src/or/policies.c
 index 486c264..1f11d36 100644
 --- a/src/or/policies.c
 +++ b/src/or/policies.c
 @@ -1366,8 +1366,8 @@ parse_short_policy(const char *summary)
        continue;
      }

 -    memcpy(ent_buf, summary, next-summary-1);
 -    ent_buf[next-summary-1] = '\0';
 +    memcpy(ent_buf, summary, next-summary);
 +    ent_buf[next-summary] = '\0';

      if (tor_sscanf(ent_buf, "%u-%u%c", &low, &high, &dummy) == 2) {
        if (low<1 || low>65535 || high<1 || high>65535) {
 }}}

 but we probably want to adjust our fencepost counts in the "next-summary >
 (int)(sizeof(ent_buf)-1)" clause above that too.

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


More information about the tor-bugs mailing list