]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fix crash during startup with malformed yaml
authorVictor Julien <victor@inliniac.net>
Tue, 18 Dec 2018 20:08:19 +0000 (21:08 +0100)
committerVictor Julien <victor@inliniac.net>
Sat, 16 Feb 2019 13:58:18 +0000 (14:58 +0100)
detect-engine:
  custom-values:
    toclient-groups: 200
    toserver-groups: 200

Bug #2745

src/detect-engine.c
src/util-luajit.c

index 978bf34bb3bc45887e96e073a2592c9f704cdd4f..9f3aba394c1494d3786a23f4a4c74f82fbea363e 100644 (file)
@@ -1203,13 +1203,13 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
     if (de_ctx_custom != NULL) {
         TAILQ_FOREACH(opt, &de_ctx_custom->head, next) {
             if (de_ctx_profile == NULL) {
-                if (strcmp(opt->val, "profile") == 0) {
+                if (opt->val && strcmp(opt->val, "profile") == 0) {
                     de_ctx_profile = opt->head.tqh_first->val;
                 }
             }
 
             if (sgh_mpm_context == NULL) {
-                if (strcmp(opt->val, "sgh-mpm-context") == 0) {
+                if (opt->val && strcmp(opt->val, "sgh-mpm-context") == 0) {
                     sgh_mpm_context = opt->head.tqh_first->val;
                 }
             }
@@ -1305,7 +1305,7 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
 
             if (de_ctx_custom != NULL) {
                 TAILQ_FOREACH(opt, &de_ctx_custom->head, next) {
-                    if (strcmp(opt->val, "custom-values") == 0) {
+                    if (opt->val && strcmp(opt->val, "custom-values") == 0) {
                         if (max_uniq_toclient_groups_str == NULL) {
                             max_uniq_toclient_groups_str = (char *)ConfNodeLookupChildValue
                                 (opt->head.tqh_first, "toclient-sp-groups");
@@ -1384,7 +1384,7 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx)
         if (de_ctx_custom != NULL) {
             opt = NULL;
             TAILQ_FOREACH(opt, &de_ctx_custom->head, next) {
-                if (strcmp(opt->val, "inspection-recursion-limit") != 0)
+                if (opt->val && strcmp(opt->val, "inspection-recursion-limit") != 0)
                     continue;
 
                 insp_recursion_limit_node = ConfNodeLookupChild(opt, opt->val);
index cb11dc79af46496173a9d824f17d4db3a06ceea5..31e5117b73584c2f6e04bd846d4de91ce768c176 100644 (file)
@@ -77,7 +77,7 @@ int LuajitSetupStatesPool(void)
             ConfNode *decnf = ConfGetNode("detect-engine");
             if (decnf != NULL) {
                 TAILQ_FOREACH(denode, &decnf->head, next) {
-                    if (strcmp(denode->val, "luajit-states") == 0) {
+                    if (denode->val && strcmp(denode->val, "luajit-states") == 0) {
                         ConfGetChildValueInt(denode, "luajit-states", &cnt);
                     }
                 }