]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rules kr_view_insert_action(): fix subnet truncation
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 12 Jul 2023 14:24:44 +0000 (16:24 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 12 Jul 2023 14:24:44 +0000 (16:24 +0200)
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.

lib/rules/api.c

index 325ed77df3528fba4ed3f1649af56b9499af8f94..6abc0ac1f23eb95dd59a2ed7e2b560d902d6a014 100644 (file)
@@ -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);
        }