mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 08:02:06 -04:00
The final round of adding RUNTIME_CHECK() around dns_name_copy() calls
This commit was done by hand to add the RUNTIME_CHECK() around stray dns_name_copy() calls with NULL as third argument. This covers the edge cases that doesn't make sense to write a semantic patch since the usage pattern was unique or almost unique.
This commit is contained in:
parent
89b269b0d2
commit
5efa29e03a
6 changed files with 52 additions and 49 deletions
|
|
@ -2154,22 +2154,26 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||
isc_buffer_init(&b, textname, len);
|
||||
isc_buffer_add(&b, len);
|
||||
result = dns_name_fromtext(name, &b, NULL, 0, NULL);
|
||||
if (result == ISC_R_SUCCESS &&
|
||||
!dns_name_isabsolute(name))
|
||||
result = dns_name_concatenate(name,
|
||||
lookup->oname,
|
||||
lookup->name,
|
||||
&lookup->namebuf);
|
||||
else if (result == ISC_R_SUCCESS)
|
||||
result = dns_name_copy(name, lookup->name,
|
||||
&lookup->namebuf);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (!dns_name_isabsolute(name)) {
|
||||
result = dns_name_concatenate(name,
|
||||
lookup->oname,
|
||||
lookup->name,
|
||||
&lookup->namebuf);
|
||||
} else {
|
||||
result = dns_name_copy(name,
|
||||
lookup->name,
|
||||
&lookup->namebuf);
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_message_puttempname(lookup->sendmsg,
|
||||
&lookup->name);
|
||||
dns_message_puttempname(lookup->sendmsg,
|
||||
&lookup->oname);
|
||||
if (result == DNS_R_NAMETOOLONG)
|
||||
if (result == DNS_R_NAMETOOLONG) {
|
||||
return (false);
|
||||
}
|
||||
fatal("'%s' is not in legal name syntax (%s)",
|
||||
lookup->textname,
|
||||
isc_result_totext(result));
|
||||
|
|
|
|||
|
|
@ -936,12 +936,10 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
|
|||
dns_rdata_reset(&rdata);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
goto done;
|
||||
tresult = dns_name_copy(&cname.cname, name, NULL);
|
||||
RUNTIME_CHECK(dns_name_copy(&cname.cname, name, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
dns_rdata_freestruct(&cname);
|
||||
if (tresult == ISC_R_SUCCESS)
|
||||
want_restart = true;
|
||||
else
|
||||
result = tresult;
|
||||
want_restart = true;
|
||||
goto done;
|
||||
case DNS_R_DNAME:
|
||||
/*
|
||||
|
|
@ -2832,7 +2830,8 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
action, arg, sizeof(*uctx->event));
|
||||
if (zonename != NULL) {
|
||||
uctx->zonename = dns_fixedname_name(&uctx->zonefname);
|
||||
result = dns_name_copy(zonename, uctx->zonename, NULL);
|
||||
RUNTIME_CHECK(dns_name_copy(zonename, uctx->zonename, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
if (servers != NULL) {
|
||||
for (server = ISC_LIST_HEAD(*servers);
|
||||
|
|
|
|||
|
|
@ -3188,10 +3188,12 @@ dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name,
|
|||
}
|
||||
|
||||
if (origin != NULL) {
|
||||
if (chain->level_count > 0)
|
||||
if (chain->level_count > 0) {
|
||||
result = chain_name(chain, origin, false);
|
||||
else
|
||||
result = dns_name_copy(dns_rootname, origin, NULL);
|
||||
} else {
|
||||
RUNTIME_CHECK(dns_name_copy(dns_rootname, origin, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
|
|
|||
|
|
@ -4517,21 +4517,27 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node,
|
|||
if (foundname != NULL) {
|
||||
dns_name_init(&name, NULL);
|
||||
dns_rbt_namefromnode(node, &name);
|
||||
result = dns_name_copy(&name, foundname, NULL);
|
||||
while (result == ISC_R_SUCCESS && i > 0) {
|
||||
RUNTIME_CHECK(dns_name_copy(&name, foundname,
|
||||
NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
while (i > 0) {
|
||||
i--;
|
||||
level_node = search->chain.levels[i];
|
||||
dns_name_init(&name, NULL);
|
||||
dns_rbt_namefromnode(level_node,
|
||||
&name);
|
||||
result =
|
||||
dns_name_concatenate(foundname,
|
||||
&name,
|
||||
foundname,
|
||||
NULL);
|
||||
result = dns_name_concatenate(foundname,
|
||||
&name,
|
||||
foundname,
|
||||
NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
*nodep = NULL;
|
||||
if (nodep != NULL) {
|
||||
*nodep = NULL;
|
||||
}
|
||||
goto node_exit;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5192,7 +5192,6 @@ same_question(fetchctx_t *fctx) {
|
|||
static void
|
||||
clone_results(fetchctx_t *fctx) {
|
||||
dns_fetchevent_t *event, *hevent;
|
||||
isc_result_t result;
|
||||
dns_name_t *name, *hname;
|
||||
|
||||
FCTXTRACE("clone_results");
|
||||
|
|
@ -5213,11 +5212,9 @@ clone_results(fetchctx_t *fctx) {
|
|||
event != NULL;
|
||||
event = ISC_LIST_NEXT(event, ev_link)) {
|
||||
name = dns_fixedname_name(&event->foundname);
|
||||
result = dns_name_copy(hname, name, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
event->result = result;
|
||||
else
|
||||
event->result = hevent->result;
|
||||
RUNTIME_CHECK(dns_name_copy(hname, name, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
event->result = hevent->result;
|
||||
dns_db_attach(hevent->db, &event->db);
|
||||
dns_db_attachnode(hevent->db, hevent->node, &event->node);
|
||||
INSIST(hevent->rdataset != NULL);
|
||||
|
|
|
|||
|
|
@ -5515,11 +5515,8 @@ query_lookup(query_ctx_t *qctx) {
|
|||
* Fixup fname and sigrdataset.
|
||||
*/
|
||||
if (qctx->dns64 && qctx->rpz) {
|
||||
isc_result_t rresult;
|
||||
|
||||
rresult = dns_name_copy(qctx->client->query.qname,
|
||||
qctx->fname, NULL);
|
||||
RUNTIME_CHECK(rresult == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_copy(qctx->client->query.qname,
|
||||
qctx->fname, NULL) == ISC_R_SUCCESS);
|
||||
if (qctx->sigrdataset != NULL &&
|
||||
dns_rdataset_isassociated(qctx->sigrdataset))
|
||||
{
|
||||
|
|
@ -5685,8 +5682,6 @@ static void
|
|||
recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype,
|
||||
const dns_name_t *qname, const dns_name_t *qdomain)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(param != NULL);
|
||||
|
||||
param->qtype = qtype;
|
||||
|
|
@ -5695,16 +5690,16 @@ recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype,
|
|||
param->qname = NULL;
|
||||
} else {
|
||||
param->qname = dns_fixedname_initname(¶m->fqname);
|
||||
result = dns_name_copy(qname, param->qname, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_copy(qname, param->qname, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (qdomain == NULL) {
|
||||
param->qdomain = NULL;
|
||||
} else {
|
||||
param->qdomain = dns_fixedname_initname(¶m->fqdomain);
|
||||
result = dns_name_copy(qdomain, param->qdomain, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_copy(qdomain, param->qdomain, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
}
|
||||
static atomic_uint_fast32_t last_soft, last_hard;
|
||||
|
|
@ -6375,9 +6370,9 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) {
|
|||
* we looked up even if we were stopped short
|
||||
* in recursion or for a deferral.
|
||||
*/
|
||||
rresult = dns_name_copy(qctx->client->query.qname,
|
||||
qctx->fname, NULL);
|
||||
RUNTIME_CHECK(rresult == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_copy(qctx->client->query.qname,
|
||||
qctx->fname, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
rpz_clean(&qctx->zone, &qctx->db, &qctx->node, NULL);
|
||||
if (qctx->rpz_st->m.rdataset != NULL) {
|
||||
ns_client_putrdataset(qctx->client, &qctx->rdataset);
|
||||
|
|
@ -6550,8 +6545,8 @@ query_rpzcname(query_ctx_t *qctx, dns_name_t *cname) {
|
|||
return (result);
|
||||
}
|
||||
} else {
|
||||
result = dns_name_copy(cname, qctx->fname, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_copy(cname, qctx->fname, NULL)
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
ns_client_keepname(client, qctx->fname, qctx->dbuf);
|
||||
|
|
|
|||
Loading…
Reference in a new issue