]> git.ipfire.org Git - thirdparty/suricata.git/commit
unittests: alloc Packet with PacketGetFromAlloc
authorJuliana Fajardini <jufajardini@gmail.com>
Mon, 2 May 2022 22:22:33 +0000 (19:22 -0300)
committerVictor Julien <vjulien@oisf.net>
Fri, 3 Jun 2022 09:55:42 +0000 (11:55 +0200)
commit46844f52a107846742193c025541289df115fefe
tree77f1031daf275bba6bd7ed87324cc20d2bf7525f
parent720f84ebce13cdeb9c219afb75d294b8c293a7da
unittests: alloc Packet with PacketGetFromAlloc

Some unittests used SCMalloc for allocating new Packet the unittests.
While this is valid, it leads to segmentation faults when we move to
dynamic allocation of the maximum alerts allowed to be triggered by a
single packet.

This massive patch uses PacketGetFromAlloc, which initializes a Packet
in such a way that any dynamic allocated structures within will also be
initialized.

Backport: edit a few more files/unittests that were not present in 7.0.x

Related to
Task #4207

(cherry picked from commit ccd45345811dfa4c20a5755f7506dd3e81cfdd38)
20 files changed:
src/decode-ethernet.c
src/decode-icmpv4.c
src/decode-icmpv6.c
src/decode-ipv4.c
src/decode-mpls.c
src/detect-content.c
src/detect-dsize.c
src/detect-engine-event.c
src/detect-flowbits.c
src/detect-fragbits.c
src/detect-fragoffset.c
src/detect-ftpbounce.c
src/detect-hostbits.c
src/detect-ipopts.c
src/detect-ipproto.c
src/detect-parse.c
src/detect-tcp-flags.c
src/detect-xbits.c
src/stream-tcp.c
src/tests/detect.c