]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fixes InspectionBuffer id with transforms
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 13 Sep 2021 10:18:34 +0000 (12:18 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 12 Nov 2021 14:21:06 +0000 (15:21 +0100)
When InspectionBufferGet gets called with base_id
Later InspectionBufferSetup must also be called with base_id

In case there were transforms, we had base_id != list_id

Not calling InspectionBufferSetup with the right id
resulted in leaving a dangling pointer,
because it was not added to det_ctx->inspect.to_clear_queue

Bug: #4681.

src/detect-file-data.c
src/detect-http-client-body.c

index 4ec99bd968cadba2606034a5a2145edd65004c0c..515bc4e9d96836bf06ebd5449eb0a7806df887a8 100644 (file)
@@ -366,7 +366,7 @@ static InspectionBuffer *HttpServerBodyGetDataCallback(DetectEngineThreadCtx *de
 
     StreamingBufferGetDataAtOffset(body->sb,
             &data, &data_len, offset);
-    InspectionBufferSetup(det_ctx, list_id, buffer, data, data_len);
+    InspectionBufferSetup(det_ctx, base_id, buffer, data, data_len);
     buffer->inspect_offset = offset;
     body->body_inspected = body->content_len_so_far;
     SCLogDebug("body->body_inspected now: %" PRIu64, body->body_inspected);
index 617f179a60ffe72fb5e5091ff8970101e2fb957b..8fe1802bf657741babcbcc08d0c8644469555a52 100644 (file)
@@ -284,7 +284,7 @@ static InspectionBuffer *HttpRequestBodyGetDataCallback(DetectEngineThreadCtx *d
 
     StreamingBufferGetDataAtOffset(body->sb,
             &data, &data_len, offset);
-    InspectionBufferSetup(det_ctx, list_id, buffer, data, data_len);
+    InspectionBufferSetup(det_ctx, base_id, buffer, data, data_len);
     buffer->inspect_offset = offset;
     body->body_inspected = body->content_len_so_far;
     SCLogDebug("body->body_inspected now: %" PRIu64, body->body_inspected);