]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rule-analyzer: Ensure content counts are accurate
authorJeff Lucovsky <jeff@lucovsky.org>
Mon, 18 Mar 2019 00:04:02 +0000 (20:04 -0400)
committerVictor Julien <victor@inliniac.net>
Wed, 3 Apr 2019 18:39:08 +0000 (20:39 +0200)
Fix for issue 2605.  Make sure that content is counted,
even if none of the specific content types are matched.

src/detect-engine-analyzer.c

index f417695ab4d77250a35c962ec5b0896786216bdd..0e75b684f8bd659a402f9c904d36f4ae192004e7 100644 (file)
@@ -1063,6 +1063,8 @@ void EngineAnalysisRules(const DetectEngineCtx *de_ctx,
                         (DETECT_CONTENT_OFFSET | DETECT_CONTENT_DEPTH)) {
                         rule_content_offset_depth++;
                     }
+                } else {
+                    rule_content += 1;
                 }
             }
             else if (sm->type == DETECT_FLOW) {
@@ -1246,7 +1248,7 @@ void EngineAnalysisRules(const DetectEngineCtx *de_ctx,
         if (warn_encoding_norm_http_buf) {
             fprintf(rule_engine_analysis_FD, "    Warning: Rule may contain percent encoded content for a normalized http buffer match.\n");
         }
-        if (warn_tcp_no_flow /*rule_flow == 0 && rule_flow == 0
+        if (warn_tcp_no_flow /*rule_flow == 0 && rule_flags == 0
                 && !(s->proto.flags & DETECT_PROTO_ANY) && DetectProtoContainsProto(&s->proto, IPPROTO_TCP)*/) {
             fprintf(rule_engine_analysis_FD, "    Warning: TCP rule without a flow or flags option.\n"
                                              "             -Consider adding flow or flags to improve performance of this rule.\n");