]> 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>
Tue, 3 May 2022 07:10:02 +0000 (09:10 +0200)
commitccd45345811dfa4c20a5755f7506dd3e81cfdd38
treebc866ad345aa3fd7d3143a69dade865b1652953e
parent6d40181ede0f252b363365947ae6292f75021440
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 a6bda3596bdd1a0ac04afe5553609c6f7cba0023)
21 files changed:
src/decode-chdlc.c
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