diff --git a/src/util-mpm-hs.c b/src/util-mpm-hs.c index eca73f7cba..194a7bbd78 100644 --- a/src/util-mpm-hs.c +++ b/src/util-mpm-hs.c @@ -313,6 +313,17 @@ static int SCHSAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen, mpm_ctx->pattern_cnt++; + if (!(mpm_ctx->flags & MPMCTX_FLAGS_NODEPTH)) { + if (depth) { + mpm_ctx->maxdepth = MAX(mpm_ctx->maxdepth, depth); + SCLogDebug("%p: depth %u max %u", mpm_ctx, depth, mpm_ctx->maxdepth); + } else { + mpm_ctx->flags |= MPMCTX_FLAGS_NODEPTH; + mpm_ctx->maxdepth = 0; + SCLogDebug("%p: alas, no depth for us", mpm_ctx); + } + } + if (mpm_ctx->maxlen < patlen) mpm_ctx->maxlen = patlen;