Use the literal parse of an address in dns_resolve_impl if parsing the address as an ipv4 or ipv6 address _succeeded_. Not if it failed. Bug introduced in r17707 (post 0.2.1.8-alpha), and found by xiando.

svn:r17758
This commit is contained in:
Nick Mathewson 2008-12-24 02:38:07 +00:00
parent df608fef45
commit 272e64e674
2 changed files with 2 additions and 2 deletions

View File

@ -2611,7 +2611,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
if (rh.command == RELAY_COMMAND_BEGIN_DIR) {
tor_assert(or_circ);
if (or_circ->p_conn && !tor_addr_is_null(&or_circ->p_conn->_base.addr))
n_stream->_base.addr = or_circ->p_conn->_base.addr;
tor_addr_assign(&n_stream->_base.addr, &or_circ->p_conn->_base.addr);
return connection_exit_connect_dir(n_stream);
}

View File

@ -616,7 +616,7 @@ dns_resolve_impl(edge_connection_t *exitconn, int is_resolve,
/* first check if exitconn->_base.address is an IP. If so, we already
* know the answer. */
if (tor_addr_from_str(&addr, exitconn->_base.address)<0) {
if (tor_addr_from_str(&addr, exitconn->_base.address) >= 0) {
tor_addr_assign(&exitconn->_base.addr, &addr);
exitconn->address_ttl = DEFAULT_DNS_TTL;
return 1;