summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Doskočil <jan.doskocil@nic.cz>2025-01-02 18:20:01 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2025-01-02 18:55:20 +0100
commit3c78e8020e29cf5828a80223dfba9401d5978a51 (patch)
treec224d7a4ebe75baaef73da31cc6da9a751bfce2b
parentdoc: knotc: describe the force option for zone-flush (diff)
downloadknot-3c78e8020e29cf5828a80223dfba9401d5978a51.tar.xz
knot-3c78e8020e29cf5828a80223dfba9401d5978a51.zip
knotd: avoid crash on crafted CTL payload
There was an incorrect assumption in zones_apply() that the next DATA unit carries zonename data.
-rw-r--r--src/knot/ctl/commands.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/knot/ctl/commands.c b/src/knot/ctl/commands.c
index 8879faa77..b168f3063 100644
--- a/src/knot/ctl/commands.c
+++ b/src/knot/ctl/commands.c
@@ -235,7 +235,7 @@ static int zones_apply(ctl_args_t *args, int (*fcn)(zone_t *, ctl_args_t *))
// Get next zone name.
ret = knot_ctl_receive(args->ctl, &args->type, &args->data);
- if (ret != KNOT_EOK || args->type != KNOT_CTL_TYPE_DATA) {
+ if (ret != KNOT_EOK || args->type != KNOT_CTL_TYPE_DATA || args->data[KNOT_CTL_IDX_ZONE] == NULL) {
break;
}
strtolower((char *)args->data[KNOT_CTL_IDX_ZONE]);