]> 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 02:22:48 +0000 (12:22 +1000)
'name.ndata' should point to the source.

(cherry picked from commit 7d7fc8cb2dd1153e4ecbeb894f3e90e8225ccfdd)

tests/dns/name_test.c

index 225079fed4f8d9e06983cfed7b20b0401d375d60..acd36c9ddfaacaacdb0c686a56c1f7e45a49f779 100644 (file)
@@ -295,6 +295,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 */