Correctly handle root domain label. Credit: Himanshu Anand

This commit is contained in:
dmiller 2026-06-25 21:58:48 +00:00
parent fcabd66198
commit 8769ab35f3
2 changed files with 42 additions and 2 deletions

View file

@ -1974,8 +1974,13 @@ size_t DNS::Factory::parseDomainName(std::string &name, const u8 *buf, size_t of
max_offset++;
}
std::string::iterator it = name.end()-1;
if( *it == '.') name.erase(it);
if (name.empty()) {
name = ".";
}
else {
std::string::iterator it = name.end()-1;
if( *it == '.') name.erase(it);
}
return max_offset - offset;
}