mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
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
This commit is contained in:
parent
94a7998158
commit
16199a54a2
5
changes/ticket28879
Normal file
5
changes/ticket28879
Normal file
@ -0,0 +1,5 @@
|
||||
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
|
||||
0.1.2.7-alpha.
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user