detect/quic: update buffer initialization logic

pull/8482/head
Victor Julien 4 years ago
parent 6f1574276f
commit aa4a128fb0

@ -62,7 +62,7 @@ static int DetectQuicCyuHashSetup(DetectEngineCtx *de_ctx, Signature *s, const c
static InspectionBuffer *QuicHashGetData(DetectEngineThreadCtx *det_ctx, static InspectionBuffer *QuicHashGetData(DetectEngineThreadCtx *det_ctx,
const DetectEngineTransforms *transforms, Flow *f, struct QuicHashGetDataArgs *cbdata, const DetectEngineTransforms *transforms, Flow *f, struct QuicHashGetDataArgs *cbdata,
int list_id, bool first) int list_id)
{ {
SCEnter(); SCEnter();
@ -70,7 +70,7 @@ static InspectionBuffer *QuicHashGetData(DetectEngineThreadCtx *det_ctx,
InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id); InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id);
if (buffer == NULL) if (buffer == NULL)
return NULL; return NULL;
if (!first && buffer->inspect != NULL) if (buffer->initialized)
return buffer; return buffer;
const uint8_t *data; const uint8_t *data;
@ -101,7 +101,7 @@ static uint8_t DetectEngineInspectQuicHash(DetectEngineCtx *de_ctx, DetectEngine
txv, txv,
}; };
InspectionBuffer *buffer = 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) if (buffer == NULL || buffer->inspect == NULL)
break; break;
@ -148,8 +148,7 @@ static void PrefilterTxQuicHash(DetectEngineThreadCtx *det_ctx, const void *pect
// loop until we get a NULL // loop until we get a NULL
struct QuicHashGetDataArgs cbdata = { local_id, txv }; struct QuicHashGetDataArgs cbdata = { local_id, txv };
InspectionBuffer *buffer = InspectionBuffer *buffer = QuicHashGetData(det_ctx, ctx->transforms, f, &cbdata, list_id);
QuicHashGetData(det_ctx, ctx->transforms, f, &cbdata, list_id, true);
if (buffer == NULL) if (buffer == NULL)
break; break;

@ -60,7 +60,7 @@ static int DetectQuicCyuStringSetup(DetectEngineCtx *de_ctx, Signature *s, const
static InspectionBuffer *QuicStringGetData(DetectEngineThreadCtx *det_ctx, static InspectionBuffer *QuicStringGetData(DetectEngineThreadCtx *det_ctx,
const DetectEngineTransforms *transforms, Flow *f, struct QuicStringGetDataArgs *cbdata, const DetectEngineTransforms *transforms, Flow *f, struct QuicStringGetDataArgs *cbdata,
int list_id, bool first) int list_id)
{ {
SCEnter(); SCEnter();
@ -68,7 +68,7 @@ static InspectionBuffer *QuicStringGetData(DetectEngineThreadCtx *det_ctx,
InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id); InspectionBufferMultipleForListGet(det_ctx, list_id, cbdata->local_id);
if (buffer == NULL) if (buffer == NULL)
return NULL; return NULL;
if (!first && buffer->inspect != NULL) if (buffer->initialized)
return buffer; return buffer;
const uint8_t *data; const uint8_t *data;
@ -99,7 +99,7 @@ static uint8_t DetectEngineInspectQuicString(DetectEngineCtx *de_ctx,
txv, txv,
}; };
InspectionBuffer *buffer = 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) if (buffer == NULL || buffer->inspect == NULL)
break; break;
@ -140,8 +140,7 @@ static void PrefilterTxQuicString(DetectEngineThreadCtx *det_ctx, const void *pe
// loop until we get a NULL // loop until we get a NULL
struct QuicStringGetDataArgs cbdata = { local_id, txv }; struct QuicStringGetDataArgs cbdata = { local_id, txv };
InspectionBuffer *buffer = InspectionBuffer *buffer = QuicStringGetData(det_ctx, ctx->transforms, f, &cbdata, list_id);
QuicStringGetData(det_ctx, ctx->transforms, f, &cbdata, list_id, true);
if (buffer == NULL) if (buffer == NULL)
break; break;

Loading…
Cancel
Save