`getZoneCuts()` was constructing a `DNSName` by passing a raw label returned
from `DNSName::getRawLabels()` as a string. The constructor then tried to handle
escaped characters from the string, resulting in a different `DNSName` than the
expected one. This caused the `qname != begin` condition to be false even after
every label in `labelsToAdd` had been added, causing an UB by calling
`std::vector::back()` on an empty vector.
Using `DNSName::prependRawLabel()` instead prevents this issue since the string is
not escaped.
(cherry picked from commit
754914f0177cd990db16ff0cc29c8789e94b32bb)
// The shortest name is assumed to a zone cut
ret.push_back(qname);
while(qname != begin) {
- qname = DNSName(labelsToAdd.back()) + qname;
+ qname.prependRawLabel(labelsToAdd.back());
labelsToAdd.pop_back();
bool foundCut = false;
auto records = dro.get(qname, (uint16_t)QType::NS);