Commit 083e9c2b authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

r8873@Kushana: nickm | 2006-09-21 14:38:22 -0400

 Fix a bug: Remember, each call to escaped() replaces the value returned from the last call to escaped().


svn:r8438
parent a9424416
......@@ -19,6 +19,8 @@ Changes in version 0.1.2.2-alpha - 2006-??-??
algorithm from O(n^2) to O(n).
- Make the common memory allocation path faster on machines where
malloc(0) returns a pointer.
- Fix a debug log message in eventdns to say "X resolved to Y"
instead of "X resolved to X".
Changes in version 0.1.2.1-alpha - 2006-08-27
o Major features:
......
......@@ -520,7 +520,9 @@ safe_str(const char *address)
return address;
}
/** Equivalent to escaped(safe_str(address)) */
/** Equivalent to escaped(safe_str(address)). See reentrancy node on
* escaped(): don't use this outside the main thread, or twice in the same
* log statement. */
const char *
escaped_safe_str(const char *address)
{
......
......@@ -1464,20 +1464,26 @@ eventdns_callback(int result, char type, int count, int ttl, void *addresses,
if (type == DNS_IPv4_A && count) {
char answer_buf[INET_NTOA_BUF_LEN+1];
struct in_addr in;
char *escaped_address;
uint32_t *addrs = addresses;
in.s_addr = addrs[0];
addr = ntohl(addrs[0]);
status = DNS_RESOLVE_SUCCEEDED;
tor_inet_ntoa(&in, answer_buf, sizeof(answer_buf));
escaped_address = esc_for_log(string_address);
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
escaped_safe_str(string_address),
escaped_safe_str(answer_buf)); // XXXX not ok.
safe_str(escaped_address),
escaped_safe_str(answer_buf));
tor_free(escaped_address);
} else if (type == DNS_PTR && count) {
char *escaped_address;
is_reverse = 1;
hostname = ((char**)addresses)[0];
escaped_address = esc_for_log(string_address);
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
escaped_safe_str(string_address),
escaped_safe_str(hostname)); // XXXX not ok.
safe_str(escaped_address),
escaped_safe_str(hostname));
tor_free(escaped_address);
} else if (count) {
log_warn(LD_EXIT, "eventdns returned only non-IPv4 answers for %s.",
escaped_safe_str(string_address));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment