detect/file-data: simplify content inspect loop

pull/9939/head
Victor Julien 3 years ago committed by Victor Julien
parent ee66a7246f
commit 368adf4599

@ -401,7 +401,6 @@ uint8_t DetectEngineInspectFiledata(DetectEngineCtx *de_ctx, DetectEngineThreadC
return DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES; return DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES;
} }
bool match = false;
int local_file_id = 0; int local_file_id = 0;
File *file = ffc->head; File *file = ffc->head;
for (; file != NULL; file = file->next) { for (; file != NULL; file = file->next) {
@ -418,21 +417,15 @@ uint8_t DetectEngineInspectFiledata(DetectEngineCtx *de_ctx, DetectEngineThreadC
det_ctx->buffer_offset = 0; det_ctx->buffer_offset = 0;
det_ctx->discontinue_matching = 0; det_ctx->discontinue_matching = 0;
det_ctx->inspection_recursion_counter = 0; det_ctx->inspection_recursion_counter = 0;
match = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd, const bool match = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd, NULL, f,
NULL, f, (uint8_t *)buffer->inspect, buffer->inspect_len, buffer->inspect_offset, ciflags,
(uint8_t *)buffer->inspect,
buffer->inspect_len,
buffer->inspect_offset, ciflags,
DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE); DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE);
if (match) { if (match) {
break; return DETECT_ENGINE_INSPECT_SIG_MATCH;
} }
local_file_id++; local_file_id++;
} }
if (match)
return DETECT_ENGINE_INSPECT_SIG_MATCH;
else
return DETECT_ENGINE_INSPECT_SIG_NO_MATCH; return DETECT_ENGINE_INSPECT_SIG_NO_MATCH;
} }

Loading…
Cancel
Save