diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-01-06 13:40:27 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-01-06 13:40:27 -0500 |
commit | 3bc235d97975dfa17ca6732a930b28124b92eef5 (patch) | |
tree | ed11ce9f655e2bc90d086c0ebe9a7ce8a8c427f1 /src/or/connection_edge.c | |
parent | d4b265d692aeb00cb862b7098f35e3de88055ff7 (diff) | |
download | tor-3bc235d97975dfa17ca6732a930b28124b92eef5.tar tor-3bc235d97975dfa17ca6732a930b28124b92eef5.tar.gz |
Fix a strdup() of uninitialized buffer in addressmap_get_virtual_address
Partial revert of 22f723e4a3fc32983480c7403af9d7e77a3200ea.
Bugfix on 0.2.3.0-alpha
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 8bfc8b464..463d02070 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1200,6 +1200,7 @@ addressmap_get_virtual_address(int type) } else if (type == RESOLVED_TYPE_IPV4) { // This is an imperfect estimate of how many addresses are available, but // that's ok. + struct in_addr in; uint32_t available = 1u << (32-virtual_addr_netmask_bits); while (available) { /* Don't hand out any .0 or .255 address. */ @@ -1211,7 +1212,9 @@ addressmap_get_virtual_address(int type) return NULL; } } - if (!strmap_get(addressmap, fmt_addr32(next_virtual_addr))) { + in.s_addr = htonl(next_virtual_addr); + tor_inet_ntoa(&in, buf, sizeof(buf)); + if (!strmap_get(addressmap, buf)) { ++next_virtual_addr; break; } |