mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 13:42: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.
(cherry picked from commit 5efa29e03a)
This commit is contained in:
parent
77fe5da647
commit
660307283e
7 changed files with 54 additions and 53 deletions
|
|
@ -2138,22 +2138,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));
|
||||
|
|
|
|||
|
|
@ -984,12 +984,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:
|
||||
/*
|
||||
|
|
@ -2908,7 +2906,8 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
goto fail;
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -3209,10 +3209,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);
|
||||
|
|
|
|||
|
|
@ -4559,21 +4559,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,7 +5244,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");
|
||||
|
|
@ -5265,11 +5264,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);
|
||||
|
|
|
|||
|
|
@ -3147,7 +3147,7 @@ finddlvsep(dns_validator_t *val, bool resume) {
|
|||
}
|
||||
|
||||
dlvsep = dns_fixedname_initname(&val->dlvsep);
|
||||
dns_name_copy(val->event->name, dlvsep, NULL);
|
||||
RUNTIME_CHECK(dns_name_copy(val->event->name, dlvsep, NULL) == ISC_R_SUCCESS);
|
||||
/*
|
||||
* If this is a response to a DS query, we need to look in
|
||||
* the parent zone for the trust anchor.
|
||||
|
|
@ -3198,9 +3198,7 @@ finddlvsep(dns_validator_t *val, bool resume) {
|
|||
dns_rdataset_isassociated(&val->fsigrdataset))
|
||||
{
|
||||
dns_fixedname_init(&val->fname);
|
||||
dns_name_copy(dlvname,
|
||||
dns_fixedname_name(&val->fname),
|
||||
NULL);
|
||||
RUNTIME_CHECK(dns_name_copy(dlvname, dns_fixedname_name(&val->fname), NULL) == ISC_R_SUCCESS);
|
||||
result = create_validator(val,
|
||||
dns_fixedname_name(&val->fname),
|
||||
dns_rdatatype_dlv,
|
||||
|
|
|
|||
|
|
@ -5518,11 +5518,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))
|
||||
{
|
||||
|
|
@ -5688,8 +5685,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;
|
||||
|
|
@ -5698,16 +5693,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6365,9 +6360,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);
|
||||
|
|
@ -6540,8 +6535,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