From 9ee6d6906f67edc6bff071c0e996a774a90ff7f6 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 5 Jan 2010 17:42:52 +0100 Subject: [PATCH] Add some safety checks. --- src/util-mpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util-mpm.c b/src/util-mpm.c index 66fa4840c9..e31a20d10a 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -91,6 +91,7 @@ MpmMatchCleanup(MpmThreadCtx *thread_ctx) { MpmMatch *m = thread_ctx->qlist; while (m != NULL) { + BUG_ON(m == m->qnext); nxt = m->qnext; /* clear the bucket */ @@ -111,7 +112,6 @@ MpmMatchCleanup(MpmThreadCtx *thread_ctx) { m = nxt; } - } /** \brief allocate a match @@ -195,6 +195,8 @@ MpmMatchAppend(MpmThreadCtx *thread_ctx, PatternMatcherQueue *pmq, MpmEndMatch * thread_ctx->qlist = m; } + BUG_ON(m == m->qnext); + if (pmq != NULL) { /* make sure we only append a sig with a matching pattern once, * so we won't inspect it more than once. For this we keep a