Commit 3a1e804a authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2053] Fix output of right-stripped label sequences

parent d83d9fe8
......@@ -128,6 +128,11 @@ LabelSequence::toText(bool omit_final_dot) const {
result.reserve(name_.getLength());
while (np != np_end) {
if (labels == 0) {
count = 0;
break;
}
labels--;
count = *np++;
......@@ -141,11 +146,6 @@ LabelSequence::toText(bool omit_final_dot) const {
break;
}
if (labels == 0) {
count = 0;
break;
}
if (count <= Name::MAX_LABELLEN) {
assert(np_end - np >= count);
......
......@@ -303,13 +303,13 @@ TEST_F(LabelSequenceTest, toText) {
EXPECT_EQ("example.com.", ls2.toText());
ls2.stripRight(1);
EXPECT_EQ("example", ls2.toText());
EXPECT_EQ("example.com", ls2.toText());
ls2.stripRight(1);
EXPECT_EQ("", ls2.toText());
EXPECT_EQ("example", ls2.toText());
EXPECT_EQ("foo.example.org.bar.", ls8.toText());
ls8.stripRight(2);
EXPECT_EQ("foo.example", ls8.toText());
EXPECT_EQ("foo.example.org", ls8.toText());
EXPECT_EQ(".", ls7.toText());
EXPECT_THROW(ls7.stripLeft(1), isc::OutOfRange);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment