diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-17 09:14:16 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-17 09:15:37 -0500 |
commit | 16199a54a2b3f5ce94c6ca4248cbf44448ba95ae (patch) | |
tree | e1ed8b831cb65a0a32a6a503a72d58ad9318b787 /src/feature/relay | |
parent | 94a79981580d6260597f799bc1a163c8e6f07acd (diff) | |
download | tor-16199a54a2b3f5ce94c6ca4248cbf44448ba95ae.tar.gz tor-16199a54a2b3f5ce94c6ca4248cbf44448ba95ae.zip |
Check hostname before using it in send_resolved_hostname_cell()
Also, turn an absent hostname into a BUG(), not a crash.
Found by scan-build.
Closes ticket 28879; bugfix on 0.1.2.7-alpha
Diffstat (limited to 'src/feature/relay')
-rw-r--r-- | src/feature/relay/dns.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c index bc507d47f6..cc213ff8d6 100644 --- a/src/feature/relay/dns.c +++ b/src/feature/relay/dns.c @@ -586,8 +586,11 @@ send_resolved_hostname_cell,(edge_connection_t *conn, char buf[RELAY_PAYLOAD_SIZE]; size_t buflen; uint32_t ttl; + + if (BUG(!hostname)) + return; + size_t namelen = strlen(hostname); - tor_assert(hostname); tor_assert(namelen < 256); ttl = dns_clip_ttl(conn->address_ttl); |