diff options
author | teor <teor2345@gmail.com> | 2014-12-20 22:20:54 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2014-12-20 22:20:54 +1100 |
commit | 6a9cae2e1dafb756b30fda541e8b5d68cfd45f89 (patch) | |
tree | b6b7a4bdae9943809f68a8d47163dcb30b28274f /src | |
parent | f7e8bc2b4bc0d6072a337d9420cd5cd395c9f9d2 (diff) | |
download | tor-6a9cae2e1dafb756b30fda541e8b5d68cfd45f89.tar.gz tor-6a9cae2e1dafb756b30fda541e8b5d68cfd45f89.zip |
Fix clang warning, IPv6 address comment, buffer size typo
The address of an array in the middle of a structure will
always be non-NULL. clang recognises this and complains.
Disable the tautologous and redundant check to silence
this warning.
A comment about an IPv6 address string incorrectly refers
to an IPv4 address format.
A log buffer is sized 10024 rather than 10240.
Fixes bug 14001.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/address.c | 3 | ||||
-rw-r--r-- | src/common/log.c | 2 | ||||
-rw-r--r-- | src/or/connection_edge.c | 11 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/common/address.c b/src/common/address.c index a3b5df66bc..0b475fc9fd 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1119,7 +1119,8 @@ fmt_addr32(uint32_t addr) int tor_addr_parse(tor_addr_t *addr, const char *src) { - char *tmp = NULL; /* Holds substring if we got a dotted quad. */ + /* Holds substring of IPv6 address after removing square brackets */ + char *tmp = NULL; int result; struct in_addr in_tmp; struct in6_addr in6_tmp; diff --git a/src/common/log.c b/src/common/log.c index ad0da7da6b..0a21ffbd44 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -451,7 +451,7 @@ MOCK_IMPL(STATIC void, logv,(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap)) { - char buf[10024]; + char buf[10240]; size_t msg_len = 0; int formatted = 0; logfile_t *lf; diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 9ace375d74..9859cc26ea 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -744,8 +744,17 @@ connection_ap_fail_onehop(const char *failed_digest, /* we don't know the digest; have to compare addr:port */ tor_addr_t addr; if (!build_state || !build_state->chosen_exit || - !entry_conn->socks_request || !entry_conn->socks_request->address) + !entry_conn->socks_request) { + /* clang thinks that an array midway through a structure + * will never have a NULL address, under either: + * -Wpointer-bool-conversion if using !, or + * -Wtautological-pointer-compare if using == or != + * It's probably right (unless pointers overflow and wrap), + * so we just skip this check + || !entry_conn->socks_request->address + */ continue; + } if (tor_addr_parse(&addr, entry_conn->socks_request->address)<0 || !tor_addr_eq(&build_state->chosen_exit->addr, &addr) || build_state->chosen_exit->port != entry_conn->socks_request->port) |