From: Victor Julien Date: Sat, 28 Jan 2023 10:33:00 +0000 (+0100) Subject: detect/quic: update buffer initialization logic X-Git-Tag: suricata-7.0.0-rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa4a128fb0096b5f43b36233b42206a2d293306c;p=thirdparty%2Fsuricata.git detect/quic: update buffer initialization logic --- diff --git a/src/detect-quic-cyu-hash.c b/src/detect-quic-cyu-hash.c index f5ae1bcd76..519c3bd5c1 100644 --- a/src/detect-quic-cyu-hash.c +++ b/src/detect-quic-cyu-hash.c @@ -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; diff --git a/src/detect-quic-cyu-string.c b/src/detect-quic-cyu-string.c index 9ece51fe9a..3c2f8ef241 100644 --- a/src/detect-quic-cyu-string.c +++ b/src/detect-quic-cyu-string.c @@ -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;