]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
confio: fix stack-use-after-scope when processing check error
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 17 Aug 2021 16:19:09 +0000 (18:19 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 19 Aug 2021 17:45:11 +0000 (19:45 +0200)
src/knot/conf/confio.c

index 12aef671ff27b9560f055b4a0bb8ffc365d1e823..4691f0521dce5ef4ab0a39325f9f851ba8a19efe 100644 (file)
@@ -1316,6 +1316,7 @@ static int check_section(
 
        bool non_empty = false;
 
+       conf_val_t bin; // Must be in the scope of the error processing.
        for (yp_item_t *item = group->sub_items; item->name != NULL; item++) {
                args.item = item;
 
@@ -1330,7 +1331,6 @@ static int check_section(
                }
 
                // Get the item value.
-               conf_val_t bin;
                conf_db_get(conf(), conf()->io.txn, group->name, item->name, id,
                            id_len, &bin);
                if (bin.code == KNOT_ENOENT) {