Skip to content

Commit 1161965

Browse files
[#3532] Fix unittests:
* Typo in `Name::Name`: append to `ndata_`, not `ndata` * In `Name::split`, use the correct iterators for assigning
1 parent d4878eb commit 1161965

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/dns/name.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Name::Name(const char* namedata, size_t data_len, const Name* origin,
347347
// Drop the last character of the data (the \0) and append a copy of
348348
// the origin's data
349349
ndata_.erase(ndata_.end() - 1);
350-
ndata_.insert(ndata.end(), origin->ndata_.begin(), origin->ndata_.end());
350+
ndata_.insert(ndata_.end(), origin->ndata_.begin(), origin->ndata_.end());
351351

352352
// Do a similar thing with offsets. However, we need to move them
353353
// so they point after the prefix we parsed before.
@@ -662,7 +662,8 @@ Name::split(const unsigned int first, const unsigned int n) const {
662662
// original name, and append the trailing dot explicitly.
663663
//
664664
retname.ndata_.reserve(retname.offsets_.back() + 1);
665-
retname.ndata_.assign(ndata_.data() + offsets_[first], ndata_.data() + retname.offsets_.back());
665+
auto it = ndata_.data() + offsets_[first];
666+
retname.ndata_.assign(it, it + retname.offsets_.back());
666667
retname.ndata_.push_back(0);
667668

668669
retname.length_ = retname.ndata_.size();

0 commit comments

Comments
 (0)