aboutgitcodebugslistschat
path: root/test/tcp/git:
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-01-07 12:46:04 +1100
committerStefano Brivio <sbrivio@redhat.com>2026-01-10 19:27:45 +0100
commitaccc33148e0aab5597b7f409f8e97f8985c1828a (patch)
tree3c01eee258c6223f90e14eb464b0a902346d4d9b /test/tcp/git:
parent4a0c1a6f728a808822d5d912fc968470659ff97d (diff)
downloadpasst-accc33148e0aab5597b7f409f8e97f8985c1828a.tar
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.tar.gz
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.tar.bz2
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.tar.lz
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.tar.xz
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.tar.zst
passt-accc33148e0aab5597b7f409f8e97f8985c1828a.zip
treewide: Don't rely on terminator records in ip[46].dns arrays
In our arrays of DNS resolvers to pass to the guest we use a blank entry to indicate the end of the list. We rely on this when scanning the array, not having separate bounds checking. clang-tidy 21.1.7 has fancier checking for array overruns in loops, but it's not able to reason that there's always a terminating entry, so complains. Indeed, it's correct to do so in this case. Although we allow space in the arrays for the terminator (size MAXNS + 1), add_dns[46]() check only for idx >= ARRAY_SIZE() before adding an entry. This allows it to consume the last slot with a "real" entry, meaning the places where we scan really could overrun. Fix the bug, and make it easier to reason about (for both clang-tidy and people) by using ARRAY_SIZE() base bounds checking. Treat the terminator explicitly as an early exit case using 'break'. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> [sbrivio: Fix up comments to @dns in structs ip4_ctx and ip6_ctx] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/tcp/git:')
0 files changed, 0 insertions, 0 deletions