mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
detect: work around scan-build warning
detect-engine.c:2350:69: warning: Out of bound access to memory after the end of 'new_det_ctx' [security.ArrayBound]
2350 | FlowWorkerReplaceDetectCtx(SC_ATOMIC_GET(s->slot_data), new_det_ctx[i]);
| ^~~~~~~~~~~~~~
1 warning generated.
This commit is contained in:
parent
dc6696ac04
commit
02f6a4fd87
1 changed files with 4 additions and 2 deletions
|
|
@ -2283,7 +2283,7 @@ static int DetectEngineReloadThreads(DetectEngineCtx *new_de_ctx)
|
|||
uint32_t i = 0;
|
||||
|
||||
/* count detect threads in use */
|
||||
uint32_t no_of_detect_tvs = TmThreadCountThreadsByTmmFlags(TM_FLAG_FLOWWORKER_TM);
|
||||
const uint32_t no_of_detect_tvs = TmThreadCountThreadsByTmmFlags(TM_FLAG_FLOWWORKER_TM);
|
||||
/* can be zero in unix socket mode */
|
||||
if (no_of_detect_tvs == 0) {
|
||||
return 0;
|
||||
|
|
@ -2347,7 +2347,9 @@ static int DetectEngineReloadThreads(DetectEngineCtx *new_de_ctx)
|
|||
}
|
||||
SCLogDebug("swapping new det_ctx - %p with older one - %p",
|
||||
new_det_ctx[i], SC_ATOMIC_GET(s->slot_data));
|
||||
FlowWorkerReplaceDetectCtx(SC_ATOMIC_GET(s->slot_data), new_det_ctx[i++]);
|
||||
DEBUG_VALIDATE_BUG_ON(i >= no_of_detect_tvs); // help scan-build
|
||||
FlowWorkerReplaceDetectCtx(SC_ATOMIC_GET(s->slot_data), new_det_ctx[i]);
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue