diff --git a/changes/fmt_addr b/changes/fmt_addr new file mode 100644 index 0000000000..b88c9e1bf4 --- /dev/null +++ b/changes/fmt_addr @@ -0,0 +1,4 @@ + o Minor bugfixes: + - When unable to format an address as a string, report its value + as "???" rather than reusing the last formatted address. Bugfix + on 0.2.1.5-alpha. diff --git a/src/common/address.c b/src/common/address.c index d0c2d5e15c..26a59e923e 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -958,8 +958,10 @@ fmt_addr(const tor_addr_t *addr) { static char buf[TOR_ADDR_BUF_LEN]; if (!addr) return ""; - tor_addr_to_str(buf, addr, sizeof(buf), 0); - return buf; + if (tor_addr_to_str(buf, addr, sizeof(buf), 0)) + return buf; + else + return "???"; } /** Like fmt_addr(), but takes addr as a host-order IPv4