]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix NULL dereference in PacketPatternSearchWithStreamCtx code.
authorVictor Julien <victor@inliniac.net>
Thu, 23 Feb 2012 15:27:39 +0000 (16:27 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 23 Feb 2012 15:29:45 +0000 (16:29 +0100)
src/detect-engine-mpm.c

index 26d7d6049a2e5f503b99774cd7db2ce62ab88b8b..52f3521aa0c989ad50956ef491ed71b9a01432d2 100644 (file)
@@ -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);