mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Allow "none" transformation to start the transformation chain over and not crash. See #456.
This commit is contained in:
parent
13b5cdd5fc
commit
d3d4c66945
@ -137,6 +137,13 @@ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr,
|
|||||||
for(i = 1; i <= n; i++) {
|
for(i = 1; i <= n; i++) {
|
||||||
lua_rawgeti(L, idx, i);
|
lua_rawgeti(L, idx, i);
|
||||||
name = (char *)luaL_checkstring(L, -1);
|
name = (char *)luaL_checkstring(L, -1);
|
||||||
|
|
||||||
|
/* A "none" means start over */
|
||||||
|
if (strcmp("none", name) == 0) {
|
||||||
|
tfn_arr->nelts = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name);
|
tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name);
|
||||||
if (tfn == NULL) {
|
if (tfn == NULL) {
|
||||||
msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name);
|
msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name);
|
||||||
@ -146,11 +153,18 @@ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr,
|
|||||||
}
|
}
|
||||||
} else if (lua_isstring(L, idx)) { /* The second parameter may be a simple string? */
|
} else if (lua_isstring(L, idx)) { /* The second parameter may be a simple string? */
|
||||||
name = (char *)luaL_checkstring(L, idx);
|
name = (char *)luaL_checkstring(L, idx);
|
||||||
tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name);
|
|
||||||
if (tfn == NULL) {
|
/* A "none" means start over */
|
||||||
msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name);
|
if (strcmp("none", name) == 0) {
|
||||||
} else {
|
tfn_arr->nelts = 0;
|
||||||
*(msre_tfn_metadata **)apr_array_push(tfn_arr) = tfn;
|
}
|
||||||
|
else {
|
||||||
|
tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name);
|
||||||
|
if (tfn == NULL) {
|
||||||
|
msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name);
|
||||||
|
} else {
|
||||||
|
*(msre_tfn_metadata **)apr_array_push(tfn_arr) = tfn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msr_log(msr, 1, "SecRuleScript: Transformation parameter must be a transformation name or array of transformation names.");
|
msr_log(msr, 1, "SecRuleScript: Transformation parameter must be a transformation name or array of transformation names.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user