Fix auth nsec3 code (#1280)

- Fix NSEC3 code to not break on broken auth zones that include unsigned
  out of zone (above apex) data. Could lead to hang while trying to
  prove a wildcard answer.
  Reported by Dmitrii Kuvaiskii from Amazon Web Services.

- Tests for NSEC3 auth zones with out of zone data.
This commit is contained in:
Yorgos Thessalonikefs
2025-05-12 14:26:47 +02:00
committed by GitHub
parent 8190526250
commit 4e23523d1a
6 changed files with 523 additions and 20 deletions
+18
View File
@@ -476,6 +476,23 @@ dname_test_removelabel(void)
unit_assert( l == 1 );
}
/** test dname_remove_label_limit_len */
static void
dname_test_removelabellimitlen(void)
{
uint8_t* orig = (uint8_t*)"\007example\003com\000";
uint8_t* n = orig;
size_t l = 13;
size_t lenlimit = 5; /* com.*/
unit_show_func("util/data/dname.c", "dname_remove_label_limit_len");
unit_assert(dname_remove_label_limit_len(&n, &l, lenlimit) == 1);
unit_assert( n == orig+8 );
unit_assert( l == 5 );
unit_assert(dname_remove_label_limit_len(&n, &l, lenlimit) == 0);
unit_assert( n == orig+8 );
unit_assert( l == 5 );
}
/** test dname_signame_label_count */
static void
dname_test_sigcount(void)
@@ -1024,6 +1041,7 @@ void dname_test(void)
dname_test_subdomain();
dname_test_isroot();
dname_test_removelabel();
dname_test_removelabellimitlen();
dname_test_sigcount();
dname_test_iswild();
dname_test_canoncmp();