mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
Check return value in fmt_addr
Previously, if tor_addr_to_str() returned NULL, we would reuse the last value returned by fmt_addr(). (This could happen if we were erroneously asked to format an AF_UNSPEC address.) Now instead we return "???".
This commit is contained in:
parent
3e3aac5fd5
commit
718252b253
4
changes/fmt_addr
Normal file
4
changes/fmt_addr
Normal file
@ -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.
|
@ -958,8 +958,10 @@ fmt_addr(const tor_addr_t *addr)
|
||||
{
|
||||
static char buf[TOR_ADDR_BUF_LEN];
|
||||
if (!addr) return "<null>";
|
||||
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 "???";
|
||||
}
|
||||
|
||||
/** Convert the string in <b>src</b> to a tor_addr_t <b>addr</b>. The string
|
||||
|
Loading…
Reference in New Issue
Block a user