]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: error on payload-buffer-size 0
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 21 May 2025 12:54:53 +0000 (14:54 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 21 May 2025 17:42:10 +0000 (19:42 +0200)
Ticket: 7479

It makes no sense to ask for payload, but then want 0 bytes of it.

src/output-json-alert.c
src/output-json-frame.c

index 2482112b77d4932018349731693b2f75de5b5df2..ed2bbb584ad637d9ade1c6024f6259d195b3559e 100644 (file)
@@ -1010,6 +1010,10 @@ static void JsonAlertLogSetupMetadata(AlertJsonOutputCtx *json_output_ctx, SCCon
                            "payload-buffer-size - %s. Killing engine",
                         payload_buffer_value);
                 exit(EXIT_FAILURE);
+            } else if (value == 0) {
+                // you should not ask for payload if you want 0 of it
+                SCLogError("Error payload-buffer-size should not be 0");
+                exit(EXIT_FAILURE);
             } else {
                 payload_buffer_size = value;
             }
index f66bd8f8d076208fe62c56da6789eed5f4e58214..d4f34219fd682be2a83cf3a3e8c8612e96fc2a9d 100644 (file)
@@ -529,6 +529,10 @@ static OutputInitResult JsonFrameLogInitCtxSub(SCConfNode *conf, OutputCtx *pare
             if (ParseSizeStringU32(payload_buffer_value, &value) < 0) {
                 SCLogError("Error parsing payload-buffer-size \"%s\"", payload_buffer_value);
                 goto error;
+            } else if (value == 0) {
+                // you should not ask for payload if you want 0 of it
+                SCLogError("Error payload-buffer-size should not be 0");
+                goto error;
             }
             payload_buffer_size = value;
         }