From: Victor Julien Date: Sat, 28 Jan 2023 10:29:20 +0000 (+0100) Subject: detect/krb5.sname: update buffer initialization logic X-Git-Tag: suricata-7.0.0-rc1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83e97a9283a2a42defca4b6394e409ac71f5e910;p=thirdparty%2Fsuricata.git detect/krb5.sname: update buffer initialization logic --- diff --git a/src/detect-krb5-sname.c b/src/detect-krb5-sname.c index 544dd9e711..391c82d71a 100644 --- a/src/detect-krb5-sname.c +++ b/src/detect-krb5-sname.c @@ -56,9 +56,8 @@ static int DetectKrb5SNameSetup(DetectEngineCtx *de_ctx, Signature *s, const cha } static InspectionBuffer *GetKrb5SNameData(DetectEngineThreadCtx *det_ctx, - const DetectEngineTransforms *transforms, - Flow *_f, const struct Krb5PrincipalNameDataArgs *cbdata, - int list_id, bool first) + const DetectEngineTransforms *transforms, Flow *_f, + const struct Krb5PrincipalNameDataArgs *cbdata, int list_id) { SCEnter(); @@ -66,7 +65,7 @@ static InspectionBuffer *GetKrb5SNameData(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; uint32_t b_len = 0; @@ -95,8 +94,8 @@ static uint8_t DetectEngineInspectKrb5SName(DetectEngineCtx *de_ctx, DetectEngin while (1) { struct Krb5PrincipalNameDataArgs cbdata = { local_id, txv, }; - InspectionBuffer *buffer = GetKrb5SNameData(det_ctx, - transforms, f, &cbdata, engine->sm_list, false); + InspectionBuffer *buffer = + GetKrb5SNameData(det_ctx, transforms, f, &cbdata, engine->sm_list); if (buffer == NULL || buffer->inspect == NULL) break; @@ -149,8 +148,7 @@ static void PrefilterTxKrb5SName(DetectEngineThreadCtx *det_ctx, const void *pec // loop until we get a NULL struct Krb5PrincipalNameDataArgs cbdata = { local_id, txv }; - InspectionBuffer *buffer = GetKrb5SNameData(det_ctx, ctx->transforms, - f, &cbdata, list_id, true); + InspectionBuffer *buffer = GetKrb5SNameData(det_ctx, ctx->transforms, f, &cbdata, list_id); if (buffer == NULL) break;