[tor-bugs] #21494 [Core Tor/Tor]: Fix scan-build warnings about assigning to char**

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


#21494: Fix scan-build warnings about assigning to char**
------------------------------+----------------------------------
 Reporter:  teor              |          Owner:
     Type:  defect            |         Status:  new
 Priority:  Low               |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor      |        Version:
 Severity:  Minor             |     Resolution:
 Keywords:  clang scan-build  |  Actual Points:
Parent ID:                    |         Points:  0.2
 Reviewer:                    |        Sponsor:
------------------------------+----------------------------------
Description changed by teor:

Old description:

> scan-build complains about:
> {{{
> const char **argv; /* cli arguments */
> ...
> argv = tor_calloc(args_n, sizeof(char *));
> }}}
> and
> {{{
> process_environment_t *env =
> tor_malloc_zero(sizeof(process_environment_t));
> ...
> env->unixoid_environment_block = tor_calloc(n_env_vars + 1, sizeof(char
> *));
> }}}
>
> This is fine, and maybe there's a cast or magic comment we could use to
> make the warnings go away.

New description:

 scan-build complains about:
 tor_check_port_forwarding:
 {{{
 const char **argv; /* cli arguments */
 ...
 argv = tor_calloc(args_n, sizeof(char *));
 }}}
 and:
 process_environment_make:
 {{{
 process_environment_t *env =
 tor_malloc_zero(sizeof(process_environment_t));
 ...
 env->unixoid_environment_block = tor_calloc(n_env_vars + 1, sizeof(char
 *));
 }}}

 This is fine, and maybe there's a cast or magic comment we could use to
 make the warnings go away.

--

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


More information about the tor-bugs mailing list