]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Extract fully qualified named from source without buffer
authorMark Andrews <marka@isc.org>
Tue, 23 Apr 2024 03:34:56 +0000 (13:34 +1000)
committerMark Andrews <marka@isc.org>
Wed, 24 Apr 2024 01:38:14 +0000 (01:38 +0000)
'name.ndata' should point to the source.

tests/dns/name_test.c

index 54078921a213af8a974f65237692628c38b91f8f..c044ff993660c786c611097a4114580ccf857946 100644 (file)
@@ -476,6 +476,19 @@ ISC_RUN_TEST_IMPL(fromregion) {
        assert_int_equal(9, name.length);
        assert_ptr_equal(target, name.ndata);
        assert_true(dns_name_isabsolute(&name));
+
+       /*
+        * Extract the fully qualified name at the beginning of 'source'
+        * into 'name' where 'name.ndata' points to the source.
+        */
+       isc_buffer_init(&b, target, sizeof(target));
+       dns_name_init(&name, NULL);
+       r.base = source;
+       r.length = sizeof(source);
+       dns_name_fromregion(&name, &r);
+       assert_int_equal(9, name.length);
+       assert_ptr_equal(source, name.ndata);
+       assert_true(dns_name_isabsolute(&name));
 }
 
 /* is trust-anchor-telemetry test */