]> 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>
Tue, 18 Dec 2018 20:08:22 +0000 (21:08 +0100)
detect-engine:
  custom-values:
    toclient-groups: 200
    toserver-groups: 200

Bug #2745

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

index 5731b01c263a225ee7881709a0126a1439c06f70..376a85273093d456e9ef8f701036fa3ae267633e 100644 (file)
@@ -1782,13 +1782,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;
                 }
             }
@@ -1871,7 +1871,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");
@@ -1950,7 +1950,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);
                     }
                 }