From: Victor Julien Date: Thu, 23 Feb 2012 15:27:39 +0000 (+0100) Subject: Fix NULL dereference in PacketPatternSearchWithStreamCtx code. X-Git-Tag: suricata-1.3beta1~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e48a2edfd054c07ad237fb7ed48f399ae406ab7;p=thirdparty%2Fsuricata.git Fix NULL dereference in PacketPatternSearchWithStreamCtx code. --- diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index 26d7d6049a..52f3521aa0 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -172,11 +172,11 @@ uint32_t PacketPatternSearchWithStreamCtx(DetectEngineThreadCtx *det_ctx, uint32_t ret; - if (p->flowflags & FLOW_PKT_TOSERVER) { + if (p->flowflags & FLOW_PKT_TOSERVER && det_ctx->sgh->mpm_stream_ctx_ts != NULL) { ret = mpm_table[det_ctx->sgh->mpm_stream_ctx_ts->mpm_type]. Search(det_ctx->sgh->mpm_stream_ctx_ts, &det_ctx->mtc, &det_ctx->pmq, p->payload, p->payload_len); - } else { + } else if (p->flowflags & FLOW_PKT_TOCLIENT && det_ctx->sgh->mpm_stream_ctx_tc != NULL) { ret = mpm_table[det_ctx->sgh->mpm_stream_ctx_tc->mpm_type]. Search(det_ctx->sgh->mpm_stream_ctx_tc, &det_ctx->mtc, &det_ctx->pmq, p->payload, p->payload_len);