mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-17 01:36:08 +03:00
Code cosmetics: checks if actionset is not null before use it
This commit is contained in:
parent
a677456078
commit
aab128f810
@ -239,9 +239,9 @@ static void copy_rules_phase(apr_pool_t *mp,
|
|||||||
|
|
||||||
/* Copy the rule. */
|
/* Copy the rule. */
|
||||||
*(msre_rule **)apr_array_push(child_phase_arr) = rule;
|
*(msre_rule **)apr_array_push(child_phase_arr) = rule;
|
||||||
if (rule->actionset->is_chained) mode = 2;
|
if (rule->actionset && rule->actionset->is_chained) mode = 2;
|
||||||
} else {
|
} else {
|
||||||
if (rule->actionset->is_chained) mode = 1;
|
if (rule->actionset && rule->actionset->is_chained) mode = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mode == 2) {
|
if (mode == 2) {
|
||||||
@ -897,8 +897,10 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, int type,
|
|||||||
rule->actionset, 1);
|
rule->actionset, 1);
|
||||||
|
|
||||||
/* Keep track of the parent action for "block" */
|
/* Keep track of the parent action for "block" */
|
||||||
|
if (rule->actionset) {
|
||||||
rule->actionset->parent_intercept_action_rec = dcfg->tmp_default_actionset->intercept_action_rec;
|
rule->actionset->parent_intercept_action_rec = dcfg->tmp_default_actionset->intercept_action_rec;
|
||||||
rule->actionset->parent_intercept_action = dcfg->tmp_default_actionset->intercept_action;
|
rule->actionset->parent_intercept_action = dcfg->tmp_default_actionset->intercept_action;
|
||||||
|
}
|
||||||
|
|
||||||
/* Must NOT specify a disruptive action in logging phase. */
|
/* Must NOT specify a disruptive action in logging phase. */
|
||||||
if ((rule->actionset != NULL)
|
if ((rule->actionset != NULL)
|
||||||
@ -913,8 +915,10 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, int type,
|
|||||||
|
|
||||||
if (dcfg->tmp_chain_starter != NULL) {
|
if (dcfg->tmp_chain_starter != NULL) {
|
||||||
rule->chain_starter = dcfg->tmp_chain_starter;
|
rule->chain_starter = dcfg->tmp_chain_starter;
|
||||||
|
if (rule->actionset) {
|
||||||
rule->actionset->phase = rule->chain_starter->actionset->phase;
|
rule->actionset->phase = rule->chain_starter->actionset->phase;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rule->actionset->is_chained != 1) {
|
if (rule->actionset->is_chained != 1) {
|
||||||
/* If this rule is part of the chain but does
|
/* If this rule is part of the chain but does
|
||||||
|
@ -1781,7 +1781,7 @@ static apr_status_t msre_ruleset_process_phase_(msre_ruleset *ruleset, modsec_re
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rc == RULE_NO_MATCH) {
|
if (rc == RULE_NO_MATCH) {
|
||||||
if (rule->actionset->is_chained) {
|
if (rule->actionset && rule->actionset->is_chained) {
|
||||||
/* If the current rule is part of a chain then
|
/* If the current rule is part of a chain then
|
||||||
* we need to skip over all the rules in the chain.
|
* we need to skip over all the rules in the chain.
|
||||||
*/
|
*/
|
||||||
@ -2138,9 +2138,9 @@ static int msre_ruleset_phase_rule_remove_with_exception(msre_ruleset *ruleset,
|
|||||||
if (remove_rule) {
|
if (remove_rule) {
|
||||||
/* Do not increment j. */
|
/* Do not increment j. */
|
||||||
removed_count++;
|
removed_count++;
|
||||||
if (rule->actionset->is_chained) mode = 2; /* Remove rules in this chain. */
|
if (rule->actionset && rule->actionset->is_chained) mode = 2; /* Remove rules in this chain. */
|
||||||
} else {
|
} else {
|
||||||
if (rule->actionset->is_chained) mode = 1; /* Keep rules in this chain. */
|
if (rule->actionset && rule->actionset->is_chained) mode = 1; /* Keep rules in this chain. */
|
||||||
rules[j++] = rules[i];
|
rules[j++] = rules[i];
|
||||||
}
|
}
|
||||||
} else { /* Handling rule that is part of a chain. */
|
} else { /* Handling rule that is part of a chain. */
|
||||||
|
@ -2851,7 +2851,9 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
|
|||||||
* and we are done.
|
* and we are done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (rule->actionset) {
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
||||||
|
}
|
||||||
if(!matched_bytes)
|
if(!matched_bytes)
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
||||||
|
|
||||||
@ -3159,7 +3161,9 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
|||||||
* and we are done.
|
* and we are done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (rule->actionset) {
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
||||||
|
}
|
||||||
if(!matched_bytes)
|
if(!matched_bytes)
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
||||||
|
|
||||||
@ -3451,7 +3455,9 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
|||||||
* and we are done.
|
* and we are done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (rule->actionset) {
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0;
|
||||||
|
}
|
||||||
if(!matched_bytes)
|
if(!matched_bytes)
|
||||||
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user