From: Philippe Antoine Date: Wed, 21 May 2025 12:54:53 +0000 (+0200) Subject: output: error on payload-buffer-size 0 X-Git-Tag: suricata-8.0.0-rc1~226 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd1071a7958ad4c4ad596e159ac57ab5c3f9cfc2;p=thirdparty%2Fsuricata.git output: error on payload-buffer-size 0 Ticket: 7479 It makes no sense to ask for payload, but then want 0 bytes of it. --- diff --git a/src/output-json-alert.c b/src/output-json-alert.c index 2482112b77..ed2bbb584a 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -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; } diff --git a/src/output-json-frame.c b/src/output-json-frame.c index f66bd8f8d0..d4f34219fd 100644 --- a/src/output-json-frame.c +++ b/src/output-json-frame.c @@ -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; }