]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mpm: minor fixes and cleanups
authorVictor Julien <victor@inliniac.net>
Sat, 19 Sep 2015 11:11:35 +0000 (13:11 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 19 Sep 2015 11:20:45 +0000 (13:20 +0200)
src/detect-engine-filedata-smtp.c
src/detect-engine-mpm.c

index dc50d8c7d7086d37e3f588288a79f6bd19b22d64..829832f9dc70fde082c2b6004c479c5b4e02d0e2 100644 (file)
@@ -267,7 +267,7 @@ int DetectEngineRunSMTPMpm(DetectEngineCtx *de_ctx,
     uint32_t cnt = 0;
     uint32_t buffer_len = 0;
     uint32_t stream_start_offset = 0;
-    uint8_t *buffer = 0;
+    uint8_t *buffer = NULL;
 
     if (ffc != NULL) {
         File *file = ffc->head;
@@ -278,11 +278,10 @@ int DetectEngineRunSMTPMpm(DetectEngineCtx *de_ctx,
                                                     flags,
                                                     &buffer_len,
                                                     &stream_start_offset);
-
             if (buffer_len == 0)
                 goto end;
 
-            cnt = SMTPFiledataPatternSearch(det_ctx, buffer, buffer_len, flags);
+            cnt += SMTPFiledataPatternSearch(det_ctx, buffer, buffer_len, flags);
         }
     }
 end:
index c34ef252468e1207b4b992858a001130c9cda1f6..e9cf93fbe809340f8b26c1acf654a196d9824aea 100644 (file)
@@ -2383,7 +2383,6 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 
         PatternMatchPreparePopulateMpm(de_ctx, sh);
 
-        //if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
          if (sh->mpm_proto_tcp_ctx_ts != NULL) {
              if (sh->mpm_proto_tcp_ctx_ts->pattern_cnt == 0) {
                  MpmFactoryReClaimMpmCtx(de_ctx, sh->mpm_proto_tcp_ctx_ts);
@@ -2688,7 +2687,6 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  }
              }
          }
-        //} /* if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) */
     } else {
         MpmFactoryReClaimMpmCtx(de_ctx, sh->mpm_proto_other_ctx);
         sh->mpm_proto_other_ctx = NULL;