+4624. [bug] Check isc_mem_strdup results in dns_view_setnewzones.
+ [RT #45210]
+
4622. [bug] Remove unnecessary escaping of semicolon in CAA and
URI records. [RT #45216]
allow = cfg_obj_asboolean(nz);
if (!allow) {
- dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
- return (ISC_R_SUCCESS);
+ return (dns_view_setnewzones(view, ISC_FALSE, NULL, NULL));
}
nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg));
if (nzcfg == NULL) {
- dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
+ result = dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
+ RUNTIME_CHECK(result == ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
}
- dns_view_setnewzones(view, allow, nzcfg, newzone_cfgctx_destroy);
-
memset(nzcfg, 0, sizeof(*nzcfg));
+
+ result = dns_view_setnewzones(view, allow, nzcfg,
+ newzone_cfgctx_destroy);
+ if (result != ISC_R_SUCCESS) {
+ isc_mem_put(view->mctx, nzcfg, sizeof(*nzcfg));
+ return (ISC_R_NOMEMORY);
+ }
+
isc_mem_attach(view->mctx, &nzcfg->mctx);
cfg_obj_attach(config, &nzcfg->config);
cfg_parser_attach(parser, &nzcfg->parser);
* \li 'dnskey' is valid.
*/
-void
+isc_result_t
dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
void (*cfg_destroy)(void **));
/*%<
*
* Requires:
* \li 'view' is valid.
+ *
+ * Returns:
+ * \li ISC_R_SUCCESS
+ * \li ISC_R_NOMEMORY
*/
void
* findzone method. If successful, '*dbp' is set to point to the
* DLZ database.
*
- * Returns:
- * \li ISC_R_SUCCESS
- * \li ISC_R_NOTFOUND
- *
* Requires:
* \li 'view' is valid.
* \li 'name' is not NULL.
* \li 'dbp' is not NULL and *dbp is NULL.
+ *
+ * Returns:
+ * \li ISC_R_SUCCESS
+ * \li ISC_R_NOTFOUND
*/
ISC_LANG_ENDDECLS
destroy(dns_view_t *view) {
dns_dns64_t *dns64;
dns_dlzdb_t *dlzdb;
+ isc_result_t result;
REQUIRE(!ISC_LINK_LINKED(view, link));
REQUIRE(isc_refcount_current(&view->references) == 0);
dns_peerlist_detach(&view->peers);
if (view->dynamickeys != NULL) {
- isc_result_t result;
char template[20];
char keyfile[20];
FILE *fp = NULL;
dns_zone_detach(&view->managed_keys);
if (view->redirect != NULL)
dns_zone_detach(&view->redirect);
- dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
+ result = dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
+ RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_fwdtable_destroy(&view->fwdtable);
dns_aclenv_destroy(&view->aclenv);
DESTROYLOCK(&view->lock);
#define NZF ".nzf"
-void
+isc_result_t
dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
void (*cfg_destroy)(void **))
{
/* Truncate the hash at 16 chars; full length is overkill */
isc_string_printf(buffer + 16, sizeof(NZF), "%s", NZF);
view->new_zone_file = isc_mem_strdup(view->mctx, buffer);
+ if (view->new_zone_file == NULL)
+ return (ISC_R_NOMEMORY);
view->new_zone_config = cfgctx;
view->cfg_destroy = cfg_destroy;
}
+ return (ISC_R_SUCCESS);
}
isc_result_t