mirror of
https://github.com/matrix-construct/construct
synced 2024-10-03 22:28:52 +02:00
ircd::net::dns: Empty cache key assertions.
This commit is contained in:
parent
0c78bf7a9b
commit
2dad8d8832
1 changed files with 6 additions and 0 deletions
|
@ -2492,6 +2492,7 @@ ircd::net::dns::cache::put_error(const rfc1035::question &question,
|
||||||
rstrip(question.name, '.')
|
rstrip(question.name, '.')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(!empty(host));
|
||||||
switch(question.qtype)
|
switch(question.qtype)
|
||||||
{
|
{
|
||||||
case 1: // A
|
case 1: // A
|
||||||
|
@ -2549,6 +2550,7 @@ ircd::net::dns::cache::put(const rfc1035::question &question,
|
||||||
rstrip(question.name, '.')
|
rstrip(question.name, '.')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(!empty(host));
|
||||||
switch(answer.qtype)
|
switch(answer.qtype)
|
||||||
{
|
{
|
||||||
case 1: // A
|
case 1: // A
|
||||||
|
@ -2632,6 +2634,7 @@ ircd::net::dns::cache::get(const hostport &hp,
|
||||||
//TODO: Better deduction
|
//TODO: Better deduction
|
||||||
if(hp.service || opts.srv) // deduced SRV query
|
if(hp.service || opts.srv) // deduced SRV query
|
||||||
{
|
{
|
||||||
|
assert(!empty(host(hp)));
|
||||||
thread_local char srvbuf[512];
|
thread_local char srvbuf[512];
|
||||||
const string_view srvhost
|
const string_view srvhost
|
||||||
{
|
{
|
||||||
|
@ -2679,6 +2682,9 @@ ircd::net::dns::cache::get(const hostport &hp,
|
||||||
{
|
{
|
||||||
auto &map{A};
|
auto &map{A};
|
||||||
const auto &key{rstrip(host(hp), '.')};
|
const auto &key{rstrip(host(hp), '.')};
|
||||||
|
if(unlikely(empty(key)))
|
||||||
|
return false;
|
||||||
|
|
||||||
const auto pit{map.equal_range(key)};
|
const auto pit{map.equal_range(key)};
|
||||||
if(pit.first == pit.second)
|
if(pit.first == pit.second)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue