From: Vladimír Čunát Date: Wed, 12 Jul 2023 14:24:44 +0000 (+0200) Subject: lib/rules kr_view_insert_action(): fix subnet truncation X-Git-Tag: v6.0.2~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e07c13f60a1a9f89c485f0f7d200aed287e38133;p=thirdparty%2Fknot-resolver.git lib/rules kr_view_insert_action(): fix subnet truncation The rule DB keys were truncated by one byte. Unfortunately that often kept them behaving OK so it went unnoticed; but in particular any /0 views got ignored as a result. --- diff --git a/lib/rules/api.c b/lib/rules/api.c index 325ed77df..6abc0ac1f 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -848,6 +848,7 @@ int kr_view_insert_action(const char *subnet, const char *action) { // Write ruleset-specific prefix of the key. const size_t rsp_len = strlen(RULESET_DEFAULT); key.data -= rsp_len; + key.len += rsp_len; memcpy(key.data, RULESET_DEFAULT, rsp_len); }