From: Victor Julien Date: Tue, 18 Dec 2018 20:08:19 +0000 (+0100) Subject: detect: fix crash during startup with malformed yaml X-Git-Tag: suricata-4.0.7~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3cd81a087c840e8e78b373fbf39f073cfa96aea;p=thirdparty%2Fsuricata.git detect: fix crash during startup with malformed yaml detect-engine: custom-values: toclient-groups: 200 toserver-groups: 200 Bug #2745 --- diff --git a/src/detect-engine.c b/src/detect-engine.c index 978bf34bb3..9f3aba394c 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -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); diff --git a/src/util-luajit.c b/src/util-luajit.c index cb11dc79af..31e5117b73 100644 --- a/src/util-luajit.c +++ b/src/util-luajit.c @@ -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); } }