]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
afl - Don't fail if app-layer proto enabled value is NULL.
authorJason Ish <ish@unx.ca>
Mon, 20 Apr 2015 17:47:18 +0000 (11:47 -0600)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Apr 2015 12:50:42 +0000 (14:50 +0200)
Found by using AFL on suricata.yaml.

src/app-layer-detect-proto.c

index c9c406de53ec634f9299d4407ae541059fafeb3e..9545dffac7d5fada369d3c4217f294713fa28da0 100644 (file)
@@ -1630,17 +1630,20 @@ int AppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto,
         }
     }
 
-    if (strcasecmp(node->val, "yes") == 0) {
-        goto enabled;
-    } else if (strcasecmp(node->val, "no") == 0) {
-        goto disabled;
-    } else if (strcasecmp(node->val, "detection-only") == 0) {
-        goto enabled;
-    } else {
-        SCLogError(SC_ERR_FATAL, "Invalid value found for %s.", param);
-        exit(EXIT_FAILURE);
+    if (node->val) {
+        if (ConfValIsTrue(node->val)) {
+            goto enabled;
+        } else if (ConfValIsFalse(node->val)) {
+            goto disabled;
+        } else if (strcasecmp(node->val, "detection-only") == 0) {
+            goto enabled;
+        }
     }
 
+    /* Invalid or null value. */
+    SCLogError(SC_ERR_FATAL, "Invalid value found for %s.", param);
+    exit(EXIT_FAILURE);
+
  disabled:
     enabled = 0;
  enabled: