]> git.ipfire.org Git - thirdparty/suricata.git/commit
community-id: Fix IPv6 address sorting not respecting byte order 9460/head
authorArne Welzel <arne.welzel@corelight.com>
Sun, 20 Aug 2023 15:32:47 +0000 (17:32 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 7 Sep 2023 13:25:25 +0000 (15:25 +0200)
commit7408b4560c4ae01d4d932df962148dbb001469dc
tree58623d99fc8a1392c87c2b40e63e9a7ae5a36cb3
parent4257725dc0d468f557093abadee3b18cf26d5b60
community-id: Fix IPv6 address sorting not respecting byte order

When comparing IPv6 addresses based on uint32_t chunks, one needs to
apply ntohl() conversion to the individual parts, otherwise on little
endian systems individual bytes are compared in the wrong order.
Avoid this all and leverage memcmp(), it'll short circuit on the first
differing byte and its return values tells us which address sorts lower.

Bug: #6276
(cherry picked from commit 0ddc44f4c116945e0a8fa846d4f2c5ba5a7d8b63)
src/output-json.c