Commit 16199a54 authored by Nick Mathewson's avatar Nick Mathewson 👁
Browse files

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
parent 94a79981
o Minor bugfixes (correctness):
- Fix an unreached code-path where we checked the value of "hostname"
inside send_resolved_hostnam_cell(). Previously, we used it before
checking it; now we check it first. Fixes bug 28879; bugfix on
...@@ -586,8 +586,11 @@ send_resolved_hostname_cell,(edge_connection_t *conn, ...@@ -586,8 +586,11 @@ send_resolved_hostname_cell,(edge_connection_t *conn,
size_t buflen; size_t buflen;
uint32_t ttl; uint32_t ttl;
if (BUG(!hostname))
size_t namelen = strlen(hostname); size_t namelen = strlen(hostname);
tor_assert(namelen < 256); tor_assert(namelen < 256);
ttl = dns_clip_ttl(conn->address_ttl); ttl = dns_clip_ttl(conn->address_ttl);
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