]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
modules: fix knotd_conf() with NULL id
authorDaniel Salzman <daniel.salzman@nic.cz>
Mon, 19 Apr 2021 15:08:58 +0000 (17:08 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 22 Apr 2021 09:49:22 +0000 (11:49 +0200)
src/knot/nameserver/query_module.c

index 700a558b4505d02a2c40e30b17bc1a50a6ef7b8d..c7e526278091be4add5dabe9260f958b90a22e53 100644 (file)
@@ -510,10 +510,13 @@ knotd_conf_t knotd_conf(knotd_mod_t *mod, const yp_name_t *section_name,
 
        conf_t *config = (mod->config != NULL) ? mod->config : conf();
 
-       const uint8_t *raw_id = (id != NULL) ? id->single.data : NULL;
-       size_t raw_id_len = (id != NULL) ? id->single.data_len : 0;
-       conf_val_t val = conf_rawid_get(config, section_name, item_name,
-                                       raw_id, raw_id_len);
+       conf_val_t val;
+       if (id != NULL) {
+               val = conf_rawid_get(config, section_name, item_name,
+                                    id->single.data, id->single.data_len);
+       } else {
+               val = conf_get(config, section_name, item_name);
+       }
 
        set_conf_out(&out, &val);