]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/mpm: 'mpm-algo' parsing cleanups
authorVictor Julien <victor@inliniac.net>
Tue, 14 Jul 2020 09:42:55 +0000 (11:42 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 14 Jul 2020 09:42:55 +0000 (11:42 +0200)
src/detect-engine-mpm.c

index 301b360bf51aa304459f0384797551704fd3bb07..dd5314fffc3b221f7d81e4aa126f2b619d07877d 100644 (file)
@@ -619,8 +619,6 @@ uint16_t PatternMatchDefaultMatcher(void)
 
     /* Get the mpm algo defined in config file by the user */
     if ((ConfGet("mpm-algo", &mpm_algo)) == 1) {
-        uint16_t u;
-
         if (mpm_algo != NULL) {
 #if __BYTE_ORDER == __BIG_ENDIAN
             if (strcmp(mpm_algo, "ac-ks") == 0) {
@@ -631,7 +629,7 @@ uint16_t PatternMatchDefaultMatcher(void)
             if (strcmp("auto", mpm_algo) == 0) {
                 goto done;
             }
-            for (u = 0; u < MPM_TABLE_SIZE; u++) {
+            for (uint16_t u = 0; u < MPM_TABLE_SIZE; u++) {
                 if (mpm_table[u].name == NULL)
                     continue;
 
@@ -643,14 +641,13 @@ uint16_t PatternMatchDefaultMatcher(void)
         }
 
 #ifndef BUILD_HYPERSCAN
-    if ((mpm_algo != NULL) && (strcmp(mpm_algo, "hs") == 0)) {
-        FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is "
-                   "not compiled into Suricata.");
-    }
+        if ((strcmp(mpm_algo, "hs") == 0)) {
+            FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is "
+                    "not compiled into Suricata.");
+        }
 #endif
-        SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid mpm algo supplied "
+        FatalError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid mpm algo supplied "
                 "in the yaml conf file: \"%s\"", mpm_algo);
-        exit(EXIT_FAILURE);
     }
 
  done: