[tor-bugs] #21553 [Core Tor/Tor]: hs: bad use of sizeof() in encode_establish_intro_cell_legacy

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Feb 24 13:34:17 UTC 2017


#21553: hs: bad use of sizeof() in encode_establish_intro_cell_legacy
------------------------------+----------------------------------
     Reporter:  dgoulet       |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.1.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  030-backport, tor-hs
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+----------------------------------
 Found by clang analysis:

 {{{
   r = crypto_pk_private_sign_digest(intro_key, cell_body_out+len,
                                     sizeof(cell_body_out)-len,
                                     cell_body_out, len);
 }}}

 The `sizeof()` here is wrong because `cell_body_out` is a pointer.
 However, we've been saved by the fact that this length is *not* used by
 the `crypto_pk_private_sign_digest()` call except for an assert.

 This was introduced by a refactoring which went from having the body on
 the stack to a pointer as a function parameter.

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


More information about the tor-bugs mailing list