[tor-bugs] #21497 [Core Tor/Tor]: Fix scan-build warnings: memory accesses

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Feb 18 03:41:22 UTC 2017


#21497: Fix scan-build warnings: memory accesses
------------------------------+------------------------------
     Reporter:  teor          |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: unspecified
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  clang scan-build
Actual Points:                |  Parent ID:
       Points:  0.5           |   Reviewer:
      Sponsor:                |
------------------------------+------------------------------
 These should all be ok.

 router_get_hash_impl_helper:
 {{{
 -  if (start != s && *(start-1) != '\n') {
 +  if (start > s && *(start-1) != '\n') {
 }}}

 read_escaped_data:
 This is just a false positive, we should add ignore comments:
 {{{
 if (n_to_copy && *(next-1) == '\r')
 }}}

 format_win_cmdline_argument:
 These are just false positives, we should add ignore comments around the
 trailing quote and terminator assignments:
 {{{
 formatted_arg[i++] = '"';
 }}}
 {{{
 formatted_arg[i] = '\0';
 }}}

 unescape_string:
 These are just false positives, we should add ignore comments:
 {{{
 *out++ = *cp++;
 }}}
 {{{
 *out++ = cp[1];
 }}}
 {{{
 *out++ = (char)n;
 }}}
 {{{
 *out++ = ((x1<<4) + x2);
 }}}
 {{{
 case 'n': *out++ = '\n'; cp += 2; break;
 case 'r': *out++ = '\r'; cp += 2; break;
 case 't': *out++ = '\t'; cp += 2; break;
 }}}
 {{{
 *out = '\0';
 }}}

 tor_escape_str_for_pt_args:
 These are just false positives, we should add ignore comments:
 {{{
 *new_cp = '\0'; /* NUL-terminate the new string */
 }}}
 {{{
 *new_cp++ = *string++;
 }}}

 process_environment_make:
 This is just a false positive, we should add ignore comments:
 {{{
 memcpy(cp, s, slen+1);
 }}}

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


More information about the tor-bugs mailing list