aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.h
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-09-29 07:04:49 +0200
committerNick Mathewson <nickm@torproject.org>2015-09-29 10:17:05 +0200
commit7fa102b48783b51673095e1ddcb2f88050a2ba32 (patch)
tree2ca26db29d68f8a31397b1c04a16a752b5d9f04b /src/common/address.h
parent3ea834ce0a63f275fd806f9ebeec64a2bbcd1b55 (diff)
downloadtor-7fa102b48783b51673095e1ddcb2f88050a2ba32.tar.gz
tor-7fa102b48783b51673095e1ddcb2f88050a2ba32.zip
Add checks and unit tests for get_interface_address* failure
Ensure that either a valid address is returned in address pointers, or that the address data is zeroed on error. Ensure that free_interface_address6_list handles NULL lists. Add unit tests for get_interface_address* failure cases. Fixes bug #17173. Patch by fk/teor, not in any released version of tor.
Diffstat (limited to 'src/common/address.h')
-rw-r--r--src/common/address.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/address.h b/src/common/address.h
index 7d49fb59bc..d2841e1c9d 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -310,11 +310,11 @@ get_interface_address_list(int severity, int include_internal)
tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port);
#ifdef ADDRESS_PRIVATE
-STATIC smartlist_t *get_interface_addresses_raw(int severity);
+MOCK_DECL(smartlist_t *,get_interface_addresses_raw,(int severity));
STATIC int tor_addr_is_multicast(const tor_addr_t *a);
-STATIC int get_interface_address6_via_udp_socket_hack(int severity,
- sa_family_t family,
- tor_addr_t *addr);
+MOCK_DECL(int,get_interface_address6_via_udp_socket_hack,(int severity,
+ sa_family_t family,
+ tor_addr_t *addr));
#ifdef HAVE_IFADDRS_TO_SMARTLIST
STATIC smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa);