mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
4612. [bug] Silence 'may be use uninitalised' warning and simplify
the code in lwres/getaddinfo:process_answer. [RT #45158]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
4612. [bug] Silence 'may be use uninitalised' warning and simplify
|
||||
the code in lwres/getaddinfo:process_answer.
|
||||
[RT #45158]
|
||||
|
||||
4611. [bug] The default LMDB mapsize was too low and caused
|
||||
errors after few thousand zones were added using
|
||||
rndc addzone. A new config option "lmdb-mapsize"
|
||||
|
@@ -681,6 +681,7 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
dns_clientresevent_t *rev = (dns_clientresevent_t *)event;
|
||||
dns_rdatatype_t qtype;
|
||||
dns_name_t *name;
|
||||
isc_boolean_t wantcname;
|
||||
|
||||
REQUIRE(trans != NULL);
|
||||
resstate = trans->resstate;
|
||||
@@ -724,14 +725,26 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
wantcname = ISC_TF((resstate->head->ai_flags & AI_CANONNAME) != 0);
|
||||
|
||||
/* Parse the response and construct the addrinfo chain */
|
||||
for (name = ISC_LIST_HEAD(rev->answerlist); name != NULL;
|
||||
name = ISC_LIST_NEXT(name, link)) {
|
||||
isc_result_t result;
|
||||
dns_rdataset_t *rdataset;
|
||||
isc_buffer_t b;
|
||||
isc_region_t r;
|
||||
char t[1024];
|
||||
char cname[1024];
|
||||
|
||||
if (wantcname) {
|
||||
isc_buffer_t b;
|
||||
|
||||
isc_buffer_init(&b, cname, sizeof(cname));
|
||||
result = dns_name_totext(name, ISC_TRUE, &b);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
error = EAI_FAIL;
|
||||
goto done;
|
||||
}
|
||||
isc_buffer_putuint8(&b, '\0');
|
||||
}
|
||||
|
||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||
rdataset != NULL;
|
||||
@@ -741,17 +754,6 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
if (rdataset->type != qtype)
|
||||
continue;
|
||||
|
||||
if ((resstate->head->ai_flags & AI_CANONNAME) != 0) {
|
||||
isc_buffer_init(&b, t, sizeof(t));
|
||||
result = dns_name_totext(name, ISC_TRUE, &b);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
error = EAI_FAIL;
|
||||
goto done;
|
||||
}
|
||||
isc_buffer_putuint8(&b, '\0');
|
||||
isc_buffer_usedregion(&b, &r);
|
||||
}
|
||||
|
||||
for (result = dns_rdataset_first(rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdataset)) {
|
||||
@@ -780,7 +782,8 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_a,
|
||||
result = dns_rdata_tostruct(&rdata,
|
||||
&rdata_a,
|
||||
NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
SIN(ai->ai_addr)->sin_port =
|
||||
@@ -791,7 +794,8 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
break;
|
||||
case AF_INET6:
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_aaaa,
|
||||
result = dns_rdata_tostruct(&rdata,
|
||||
&rdata_aaaa,
|
||||
NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
SIN6(ai->ai_addr)->sin6_port =
|
||||
@@ -802,10 +806,8 @@ process_answer(isc_task_t *task, isc_event_t *event) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((resstate->head->ai_flags & AI_CANONNAME)
|
||||
!= 0) {
|
||||
ai->ai_canonname =
|
||||
strdup((const char *)r.base);
|
||||
if (wantcname) {
|
||||
ai->ai_canonname = strdup(cname);
|
||||
if (ai->ai_canonname == NULL) {
|
||||
error = EAI_MEMORY;
|
||||
goto done;
|
||||
|
Reference in New Issue
Block a user