[tor-bugs] #24480 [Core Tor/Tor]: Signed/unsigned mismatch

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Dec 1 15:57:33 UTC 2017


#24480: Signed/unsigned mismatch
--------------------------+------------------------------
 Reporter:  ln5           |          Owner:  (none)
     Type:  defect        |         Status:  needs_review
 Priority:  Medium        |      Milestone:
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------

Comment (by nickm):

 Bug confirmed.

 For the fix, how about we just change keylen to ssize_t instead?  It is a
 smaller and much less risky change, since it's only a local variable, and
 only used in one place.

 Example patch:
 {{{
 diff --git a/src/or/rendservice.c b/src/or/rendservice.c
 index ba8891eade39ea..80e1e10a054b4a 100644
 --- a/src/or/rendservice.c
 +++ b/src/or/rendservice.c
 @@ -1162,7 +1162,7 @@ rend_service_introduce(origin_circuit_t *circuit,
 const uint8_t *request,
    time_t now = time(NULL);
    time_t elapsed;
    int replay;
 -  size_t keylen;
 +  ssize_t keylen;

    /* Do some initial validation and logging before we parse the cell */
    if (circuit->base_.purpose != CIRCUIT_PURPOSE_S_INTRO) {
 }}}

 What do you think?

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


More information about the tor-bugs mailing list