detect/files: increment local_file_id even if buffer is NULL

Ticket: 7579

Otherwise, we will keep on calling again and again GetDataCallback
with the same local_file_id, and we will always get a NULL
buffer even if the next local_file_id would return a non-NULL buffer.
pull/13292/head
Philippe Antoine 2 months ago committed by Victor Julien
parent fd1071a795
commit b4095bf683

@ -506,8 +506,10 @@ uint8_t DetectEngineInspectFiledata(DetectEngineCtx *de_ctx, DetectEngineThreadC
for (; file != NULL; file = file->next) {
InspectionBuffer *buffer = FiledataGetDataCallback(det_ctx, transforms, f, flags, file,
engine->sm_list, engine->sm_list_base, local_file_id, txv);
if (buffer == NULL)
if (buffer == NULL) {
local_file_id++;
continue;
}
bool eof = (file->state == FILE_STATE_CLOSED);
uint8_t ciflags = eof ? DETECT_CI_FLAGS_END : 0;
@ -555,8 +557,10 @@ static void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx, const void *pect
for (File *file = ffc->head; file != NULL; file = file->next) {
InspectionBuffer *buffer = FiledataGetDataCallback(det_ctx, ctx->transforms, f, flags,
file, list_id, ctx->base_list_id, local_file_id, txv);
if (buffer == NULL)
if (buffer == NULL) {
local_file_id++;
continue;
}
SCLogDebug("[%" PRIu64 "] buffer size %u", p->pcap_cnt, buffer->inspect_len);
if (buffer->inspect_len >= mpm_ctx->minlen) {

@ -326,8 +326,10 @@ static uint8_t DetectEngineInspectFilemagic(DetectEngineCtx *de_ctx, DetectEngin
for (File *file = ffc->head; file != NULL; file = file->next) {
InspectionBuffer *buffer = FilemagicGetDataCallback(
det_ctx, transforms, f, flags, file, engine->sm_list, local_file_id);
if (buffer == NULL)
if (buffer == NULL) {
local_file_id++;
continue;
}
const bool match = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd, NULL, f,
buffer->inspect, buffer->inspect_len, buffer->inspect_offset,

@ -263,8 +263,10 @@ static uint8_t DetectEngineInspectFilename(DetectEngineCtx *de_ctx, DetectEngine
for (File *file = ffc->head; file != NULL; file = file->next) {
InspectionBuffer *buffer = FilenameGetDataCallback(
det_ctx, transforms, f, flags, file, engine->sm_list, local_file_id);
if (buffer == NULL)
if (buffer == NULL) {
local_file_id++;
continue;
}
const bool match = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd, NULL, f,
buffer->inspect, buffer->inspect_len, buffer->inspect_offset,

Loading…
Cancel
Save