aboutsummaryrefslogtreecommitdiff
path: root/src/lib/net
diff options
context:
space:
mode:
authorrl1987 <rl1987@users.noreply.github.com>2020-06-05 11:49:24 +0300
committerrl1987 <rl1987@users.noreply.github.com>2020-06-05 11:49:24 +0300
commit3e4814edeb563535b0f3bf658c01d7c10d6b4aa2 (patch)
tree95d09237925821a3c0af05c8c80b0391d502ae98 /src/lib/net
parent7a004fce8d375b7c89703a3292634af4a221691a (diff)
downloadtor-3e4814edeb563535b0f3bf658c01d7c10d6b4aa2.tar.gz
tor-3e4814edeb563535b0f3bf658c01d7c10d6b4aa2.zip
Fix some checks of tor_inet_ntoa() return value
Also, fix a format string.
Diffstat (limited to 'src/lib/net')
-rw-r--r--src/lib/net/address.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/net/address.c b/src/lib/net/address.c
index d99a1795f2..567048b5a6 100644
--- a/src/lib/net/address.c
+++ b/src/lib/net/address.c
@@ -1207,10 +1207,10 @@ fmt_addr32(uint32_t addr)
in.s_addr = htonl(addr);
success = tor_inet_ntoa(&in, buf, sizeof(buf));
- tor_assertf_nonfatal(success > 0,
- "Failed to convert IP %04X to string", addr);
+ tor_assertf_nonfatal(success >= 0,
+ "Failed to convert IP 0x%08X (HBO) to string", addr);
- if (success <= 0) {
+ IF_BUG_ONCE(success < 0) {
memset(buf, 0, INET_NTOA_BUF_LEN);
}