]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/quic: update buffer initialization logic
authorVictor Julien <vjulien@oisf.net>
Sat, 28 Jan 2023 10:33:00 +0000 (11:33 +0100)
committerVictor Julien <vjulien@oisf.net>
Sat, 28 Jan 2023 11:46:41 +0000 (12:46 +0100)
src/detect-quic-cyu-hash.c
src/detect-quic-cyu-string.c

index f5ae1bcd76791171528092d253f850eb9a14c6b6..519c3bd5c164065d5a1ae8db81c8225bbf174078 100644 (file)
@@ -62,7 +62,7 @@ static int DetectQuicCyuHashSetup(DetectEngineCtx *de_ctx, Signature *s, const c
 
 static InspectionBuffer *QuicHashGetData(DetectEngineThreadCtx *det_ctx,
         const DetectEngineTransforms *transforms, Flow *f, struct QuicHashGetDataArgs *cbdata,
-        int list_id, bool first)
+        int list_id)
 {
     SCEnter();
 
@@ -70,7 +70,7 @@ static InspectionBuffer *QuicHashGetData(DetectEngineThreadCtx *det_ctx,
             InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id);
     if (buffer == NULL)
         return NULL;
-    if (!first && buffer->inspect != NULL)
+    if (buffer->initialized)
         return buffer;
 
     const uint8_t *data;
@@ -101,7 +101,7 @@ static uint8_t DetectEngineInspectQuicHash(DetectEngineCtx *de_ctx, DetectEngine
             txv,
         };
         InspectionBuffer *buffer =
-                QuicHashGetData(det_ctx, transforms, f, &cbdata, engine->sm_list, false);
+                QuicHashGetData(det_ctx, transforms, f, &cbdata, engine->sm_list);
         if (buffer == NULL || buffer->inspect == NULL)
             break;
 
@@ -148,8 +148,7 @@ static void PrefilterTxQuicHash(DetectEngineThreadCtx *det_ctx, const void *pect
         // loop until we get a NULL
 
         struct QuicHashGetDataArgs cbdata = { local_id, txv };
-        InspectionBuffer *buffer =
-                QuicHashGetData(det_ctx, ctx->transforms, f, &cbdata, list_id, true);
+        InspectionBuffer *buffer = QuicHashGetData(det_ctx, ctx->transforms, f, &cbdata, list_id);
         if (buffer == NULL)
             break;
 
index 9ece51fe9a53e06c1821c5c57393ff77d18e7259..3c2f8ef24164ea77b65045b0c66f61984a38a541 100644 (file)
@@ -60,7 +60,7 @@ static int DetectQuicCyuStringSetup(DetectEngineCtx *de_ctx, Signature *s, const
 
 static InspectionBuffer *QuicStringGetData(DetectEngineThreadCtx *det_ctx,
         const DetectEngineTransforms *transforms, Flow *f, struct QuicStringGetDataArgs *cbdata,
-        int list_id, bool first)
+        int list_id)
 {
     SCEnter();
 
@@ -68,7 +68,7 @@ static InspectionBuffer *QuicStringGetData(DetectEngineThreadCtx *det_ctx,
             InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id);
     if (buffer == NULL)
         return NULL;
-    if (!first && buffer->inspect != NULL)
+    if (buffer->initialized)
         return buffer;
 
     const uint8_t *data;
@@ -99,7 +99,7 @@ static uint8_t DetectEngineInspectQuicString(DetectEngineCtx *de_ctx,
             txv,
         };
         InspectionBuffer *buffer =
-                QuicStringGetData(det_ctx, transforms, f, &cbdata, engine->sm_list, false);
+                QuicStringGetData(det_ctx, transforms, f, &cbdata, engine->sm_list);
         if (buffer == NULL || buffer->inspect == NULL)
             break;
 
@@ -140,8 +140,7 @@ static void PrefilterTxQuicString(DetectEngineThreadCtx *det_ctx, const void *pe
         // loop until we get a NULL
 
         struct QuicStringGetDataArgs cbdata = { local_id, txv };
-        InspectionBuffer *buffer =
-                QuicStringGetData(det_ctx, ctx->transforms, f, &cbdata, list_id, true);
+        InspectionBuffer *buffer = QuicStringGetData(det_ctx, ctx->transforms, f, &cbdata, list_id);
         if (buffer == NULL)
             break;