Opened 2 years ago

Last modified 21 months ago

#21497 new defect

Fix scan-build warnings: memory accesses

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: clang scan-build technical-debt
Cc: Actual Points:
Parent ID: Points: 0.5
Reviewer: Sponsor:

Description

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);

Child Tickets

Change History (1)

comment:1 Changed 21 months ago by nickm

Keywords: technical-debt added
Note: See TracTickets for help on using tickets.