[tor-bugs] #20581 [Core Tor/Tor]: warning: 'enc_b64_blob' may be used uninitialized in this function

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Nov 5 08:23:26 UTC 2016


#20581: warning: 'enc_b64_blob' may be used uninitialized in this function
------------------------------+------------------------------------
     Reporter:  rubiate       |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Very Low      |  Milestone:
    Component:  Core Tor/Tor  |    Version:  Tor: 0.3.0.0-alpha-dev
     Severity:  Trivial       |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+------------------------------------
 I'm seeing:

     src/or/hs_descriptor.c: In function 'desc_encode_v3':
     src/or/hs_descriptor.c:787: warning: 'enc_b64_blob' may be used
 uninitialized in this function

 It looks like any situation where enc_b64_blob doesn't get initialised it
 also doesn't get used, and clang doesn't complain, so I think this is just
 OpenBSD's old gcc being silly but could it be initialised to make it
 happy?

 {{{
 diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
 index 7c5d204..bc72034 100644
 --- a/src/or/hs_descriptor.c
 +++ b/src/or/hs_descriptor.c
 @@ -784,7 +784,7 @@ desc_encode_v3(const hs_descriptor_t *desc, char
 **encoded_out)

    /* Build the encrypted data section. */
    {
 -    char *enc_b64_blob;
 +    char *enc_b64_blob = NULL;
      if (encode_encrypted_data(desc, &enc_b64_blob) < 0) {
        goto err;
      }
 }}}

 (I didn't want to make a new ticket for this but trac wouldn't let me post
 it on #18571, sorry)

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


More information about the tor-bugs mailing list