From 8e7b147a23976f1ef889c1e1061e66139abdcb9c Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 4 Jun 2010 23:53:10 +0200 Subject: [PATCH] Fix a endless loop condition introduced by the threshold cleanup. --- src/detect-engine-threshold.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/detect-engine-threshold.c b/src/detect-engine-threshold.c index a205dfa471..027a983691 100644 --- a/src/detect-engine-threshold.c +++ b/src/detect-engine-threshold.c @@ -165,9 +165,10 @@ DetectThresholdEntry *ThresholdHashSearch(DetectEngineCtx *de_ctx, DetectThresho static inline void ThresholdTimeoutRemove(DetectEngineCtx *de_ctx, struct timeval *tv) { HashListTableBucket *next = HashListTableGetListHead(de_ctx->ths_ctx.threshold_hash_table_src); - while (next != NULL) { + for ( ; next != NULL; next = HashListTableGetListNext(next)) { DetectThresholdEntry *tsh = HashListTableGetListData(next); - BUG_ON(tsh == NULL); + if (tsh == NULL) + continue; if ((tv->tv_sec - tsh->tv_sec1) <= tsh->seconds) continue; @@ -192,8 +193,6 @@ static inline void ThresholdTimeoutRemove(DetectEngineCtx *de_ctx, struct timeva } break; } - - next = HashListTableGetListNext(next); } return;