mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Merge branch '3489-cid-355779-dynbuf-cannot-be-null' into 'main'
Fix CID 355779: dynbuf cannot be NULL Closes #3489 See merge request isc-projects/bind9!6652
This commit is contained in:
@@ -940,6 +940,18 @@ buildquery(dns_message_t *msg, const dns_name_t *name, dns_rdata_tkey_t *tkey,
|
|||||||
REQUIRE(name != NULL);
|
REQUIRE(name != NULL);
|
||||||
REQUIRE(tkey != NULL);
|
REQUIRE(tkey != NULL);
|
||||||
|
|
||||||
|
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
|
||||||
|
isc_buffer_allocate(msg->mctx, &dynbuf, len);
|
||||||
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
|
result = dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||||
|
dns_rdatatype_tkey, tkey, dynbuf);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
dns_message_puttemprdata(msg, &rdata);
|
||||||
|
isc_buffer_free(&dynbuf);
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
dns_message_takebuffer(msg, &dynbuf);
|
||||||
|
|
||||||
dns_message_gettempname(msg, &qname);
|
dns_message_gettempname(msg, &qname);
|
||||||
dns_message_gettempname(msg, &aname);
|
dns_message_gettempname(msg, &aname);
|
||||||
|
|
||||||
@@ -947,14 +959,6 @@ buildquery(dns_message_t *msg, const dns_name_t *name, dns_rdata_tkey_t *tkey,
|
|||||||
dns_rdataset_makequestion(question, dns_rdataclass_any,
|
dns_rdataset_makequestion(question, dns_rdataclass_any,
|
||||||
dns_rdatatype_tkey);
|
dns_rdatatype_tkey);
|
||||||
|
|
||||||
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
|
|
||||||
isc_buffer_allocate(msg->mctx, &dynbuf, len);
|
|
||||||
dns_message_gettemprdata(msg, &rdata);
|
|
||||||
|
|
||||||
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
|
||||||
dns_rdatatype_tkey, tkey, dynbuf));
|
|
||||||
dns_message_takebuffer(msg, &dynbuf);
|
|
||||||
|
|
||||||
dns_message_gettemprdatalist(msg, &tkeylist);
|
dns_message_gettemprdatalist(msg, &tkeylist);
|
||||||
tkeylist->rdclass = dns_rdataclass_any;
|
tkeylist->rdclass = dns_rdataclass_any;
|
||||||
tkeylist->type = dns_rdatatype_tkey;
|
tkeylist->type = dns_rdatatype_tkey;
|
||||||
@@ -982,25 +986,6 @@ buildquery(dns_message_t *msg, const dns_name_t *name, dns_rdata_tkey_t *tkey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
failure:
|
|
||||||
if (qname != NULL) {
|
|
||||||
dns_message_puttempname(msg, &qname);
|
|
||||||
}
|
|
||||||
if (aname != NULL) {
|
|
||||||
dns_message_puttempname(msg, &aname);
|
|
||||||
}
|
|
||||||
if (question != NULL) {
|
|
||||||
dns_rdataset_disassociate(question);
|
|
||||||
dns_message_puttemprdataset(msg, &question);
|
|
||||||
}
|
|
||||||
if (dynbuf != NULL) {
|
|
||||||
isc_buffer_free(&dynbuf);
|
|
||||||
}
|
|
||||||
if (rdata != NULL) {
|
|
||||||
dns_message_puttemprdata(msg, &rdata);
|
|
||||||
}
|
|
||||||
return (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
Reference in New Issue
Block a user