compiler warnings on ubuntu/jammy tor/main
Building tor/main on ubuntu jammy (their current development version) results in several compile-time warnings.
cf. https://gitlab.torproject.org/tpo/core/debian/tor/-/jobs/56151 and https://gitlab.torproject.org/tpo/core/debian/tor/-/jobs/56156 for full build logs for amd64 and arm64.
some examples; not a complete list:
../src/feature/relay/selftest.c: In function 'router_do_orport_reachability_checks':
../src/feature/relay/selftest.c:257:5: warning: potential null pointer dereference [-Wnull-dereference]
257 | log_info(LD_CIRC, "Testing %s of my %s ORPort: %s.",
| ^
../src/feature/relay/selftest.c:257:5: warning: potential null pointer dereference [-Wnull-dereference]
../src/feature/dirparse/policy_parse.c: In function 'router_parse_addr_policy':
lto1: warning: function may return address of local variable [-Wreturn-local-addr]
../src/feature/dirparse/policy_parse.c:193:17: note: declared here
193 | addr_policy_t result;
| ^
../src/core/or/channelpadding.c: In function 'channelpadding_send_enable_command':
../src/trunnel/sendme_cell.c:81:17: warning: array subscript 'struct sendme_cell_t[0]' is partly outside array bounds of 'struct channelpadding_negotiate_t[1]' [-Warray-bounds]
81 | inp->data_len = val;
| ^