mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Added t:jsDecodeUni handling unicode similar to t:urlDecodeUni. See #193.
This commit is contained in:
@@ -251,6 +251,20 @@ static int msre_fn_replaceComments_execute(apr_pool_t *mptmp, unsigned char *inp
|
||||
return changed;
|
||||
}
|
||||
|
||||
/* jsDecodeUni */
|
||||
|
||||
static int msre_fn_jsDecodeUni_execute(apr_pool_t *mptmp, unsigned char *input,
|
||||
long int input_len, char **rval, long int *rval_len)
|
||||
{
|
||||
long int length;
|
||||
|
||||
length = jsdecode_uni_nonstrict_inplace_ex(input, input_len);
|
||||
*rval = (char *)input;
|
||||
*rval_len = length;
|
||||
|
||||
return (*rval_len == input_len ? 0 : 1);
|
||||
}
|
||||
|
||||
/* urlDecode */
|
||||
|
||||
static int msre_fn_urlDecode_execute(apr_pool_t *mptmp, unsigned char *input,
|
||||
@@ -504,6 +518,12 @@ void msre_engine_register_default_tfns(msre_engine *engine) {
|
||||
msre_fn_htmlEntityDecode_execute
|
||||
);
|
||||
|
||||
/* jsDecodeUni */
|
||||
msre_engine_tfn_register(engine,
|
||||
"jsDecodeUni",
|
||||
msre_fn_jsDecodeUni_execute
|
||||
);
|
||||
|
||||
/* length */
|
||||
msre_engine_tfn_register(engine,
|
||||
"length",
|
||||
|
Reference in New Issue
Block a user