From 39ddf9991f16c24610e4c9de007c3f93e056f3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 29 Mar 2018 10:17:37 +0200 Subject: [PATCH] Do not access dns_fixedname_t fields directly Employ dns_fixedname_name() and dns_fixedname_initname() to no longer directly access dns_fixedname_t fields. --- bin/tests/optional/name_test.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/tests/optional/name_test.c b/bin/tests/optional/name_test.c index 08e05ccf96..4102ae3107 100644 --- a/bin/tests/optional/name_test.c +++ b/bin/tests/optional/name_test.c @@ -120,15 +120,16 @@ main(int argc, char *argv[]) { isc_buffer_init(&source, argv[0], len); isc_buffer_add(&source, len); dns_fixedname_init(&oname); - result = dns_name_fromtext(&oname.name, &source, - dns_rootname, 0, NULL); + result = dns_name_fromtext(dns_fixedname_name(&oname), + &source, dns_rootname, 0, + NULL); if (result != 0) { fprintf(stderr, "dns_name_fromtext() failed: %s\n", dns_result_totext(result)); exit(1); } - origin = &oname.name; + origin = dns_fixedname_name(&oname); } } else if (concatenate) origin = NULL; @@ -142,8 +143,7 @@ main(int argc, char *argv[]) { len = strlen(argv[1]); isc_buffer_init(&source, argv[1], len); isc_buffer_add(&source, len); - dns_fixedname_init(&compname); - comp = &compname.name; + comp = dns_fixedname_initname(&compname); result = dns_name_fromtext(comp, &source, origin, 0, NULL); if (result != 0) { @@ -209,11 +209,12 @@ main(int argc, char *argv[]) { if (concatenate) { if (got_name) { printf("Concatenating.\n"); - result = dns_name_concatenate(&wname.name, - &wname2.name, - &wname2.name, - NULL); - name = &wname2.name; + result = dns_name_concatenate( + dns_fixedname_name(&wname), + dns_fixedname_name(&wname2), + dns_fixedname_name(&wname2), + NULL); + name = dns_fixedname_name(&wname2); if (result == ISC_R_SUCCESS) { if (check_absolute && dns_name_countlabels(name) > 0) { @@ -331,9 +332,9 @@ main(int argc, char *argv[]) { if (concatenate) { if (got_name) - name = &wname2.name; + name = dns_fixedname_name(&wname2); else - name = &wname.name; + name = dns_fixedname_name(&wname); } }