]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
transform/base64: add explicit mode to test
authorShivani Bhardwaj <shivani@oisf.net>
Thu, 11 Jul 2024 07:58:21 +0000 (13:28 +0530)
committerVictor Julien <victor@inliniac.net>
Mon, 23 Sep 2024 16:59:25 +0000 (18:59 +0200)
Without any mode setting, the test would take up the mode to be 0 which
used to be the relax mode for base64 decoder in C. However, there was no
code corresponding to that mode and it was never used so nothing
happened when this test was run.

Add an explicit strict mode as per the expectation of the test from its
comments.

src/detect-transform-base64.c

index 69884184405b85ba2ce38186fd1ad9f6e248e3f4..f8d8f6e241b8b91345c07e26348443895158434c 100644 (file)
@@ -202,9 +202,7 @@ static int DetectTransformFromBase64DecodeTest02(void)
 {
     const uint8_t *input = (const uint8_t *)"This is Suricata\n";
     uint32_t input_len = strlen((char *)input);
-    SCDetectTransformFromBase64Data b64d = {
-        .nbytes = input_len,
-    };
+    SCDetectTransformFromBase64Data b64d = { .nbytes = input_len, .mode = Base64ModeStrict };
     InspectionBuffer buffer;
     InspectionBuffer buffer_orig;
     InspectionBufferInit(&buffer, input_len);