]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/selection*: trivial undefined-behavior fix
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 6 Apr 2021 14:47:19 +0000 (16:47 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Wed, 14 Apr 2021 14:04:16 +0000 (16:04 +0200)
lib/selection_iter.c

index 32d5a865f67e2dab17f463e6bfd82fa645278be6..7e73c0bfc3a8629c766082fa7d9cab9d598a5ec9 100644 (file)
@@ -240,7 +240,7 @@ void iter_choose_transport(struct kr_query *qry, struct kr_transport **transport
 
        unpack_state_from_zonecut(local_state, qry);
 
-       struct choice choices[trie_weight(local_state->addresses)];
+       struct choice choices[trie_weight(local_state->addresses) + 1/*avoid 0*/];
        /* We may try to resolve A and AAAA record for each name, so therefore
         * 2*trie_weight(…) is here. */
        struct to_resolve resolvable[2 * trie_weight(local_state->names)];