Skip to content

Commit a7fbd5a

Browse files
committed
Fix SIMD name scanner
1 parent 568448b commit a7fbd5a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/generic/name.h

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ static really_inline int32_t scan_name(
111111
wire += count + 1;
112112
length += count + 1;
113113
left -= count + octet;
114+
count += 1; // for correct carry
114115
} else {
115116
block.dots &= mask;
116117
text += count;

tests/syntax.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ void names(void **state)
363363
static const char only_null_labels[] = "..";
364364
static const char last_label_is_null[] = "foo..";
365365
static const char first_label_is_null[] = "..foo";
366+
static const char star_dot_3[] = "\\042.\\042.\\042.wcent.nlnetlabs.nl.";
366367

367368
static const uint8_t owner_abs_0[] = { 1, 0, 0 };
368369
static const uint8_t owner_abs_spc[] = { 1, ' ', 0 };
@@ -409,6 +410,9 @@ void names(void **state)
409410
29,'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
410411
'0','1','2','3','4','5','6','7','8','9','a','b','c',
411412
0 };
413+
static const uint8_t owner_star_dot_3[] = {
414+
1, '*', 1, '*', 1, '*', 5, 'w', 'c', 'e', 'n', 't', 9, 'n', 'l', 'n', 'e', 't', 'l', 'a', 'b', 's', 2, 'n', 'l', 0
415+
};
412416

413417
static struct names_test tests[] = {
414418
{ only_rel_label_too_long, ZONE_SYNTAX_ERROR, { 0, NULL } },
@@ -432,7 +436,8 @@ void names(void **state)
432436
{ "foo\\000.", 0, { 6, owner_abs_foo0 } },
433437
{ "foo\\000\\000.", 0, { 7, owner_abs_foo00 } },
434438
{ "foo\\..", 0, { 6, owner_abs_foodot } },
435-
{ "foo\\.", 0, { 10, owner_rel_foodot } }
439+
{ "foo\\.", 0, { 10, owner_rel_foodot } },
440+
{ star_dot_3, 0, { sizeof(owner_star_dot_3), owner_star_dot_3 } }
436441
};
437442

438443
static const uint8_t origin[] = { 3, 'f', 'o', 'o', 0 };

0 commit comments

Comments
 (0)