]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/content-inspect: add negation tests
authorVictor Julien <vjulien@oisf.net>
Tue, 19 Dec 2023 06:52:45 +0000 (07:52 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2024 19:23:28 +0000 (20:23 +0100)
Test mixing of negation, endswith and depth.

src/tests/detect-engine-content-inspection.c

index c4e1a3bdff68d8e62e35c2e24cdf02e6da4b65e0..4a72402d35aa47df2faab870ca64c07a8969133d 100644 (file)
@@ -202,6 +202,12 @@ static int DetectEngineContentInspectionTest08(void) {
     TEST_RUN("abcdefghy", 9,
             "content:\"a\"; content:!\"x\"; content:!\"c\"; distance:2; within:1; ", true, 3);
 
+    TEST_RUN("aaabbbccc", 9, "content:\"ccc\"; endswith; content:!\"bccc\"; endswith; ", false, 2);
+    TEST_RUN("aaabbbccc", 9, "content:\"ccc\"; endswith; content:!\"accc\"; endswith; ", true, 2);
+    TEST_RUN("aaabbbccc", 9, "content:\"ccc\"; endswith; content:!\"bccc\"; endswith; depth:4; ",
+            true, 2);
+    TEST_RUN("aaabbbccc", 9, "content:\"ccc\"; endswith; content:!\"bccc\"; endswith; depth:9; ",
+            false, 2);
     TEST_FOOTER;
 }