Make sure to set variable name length.

This commit is contained in:
b1v1r
2010-02-05 18:10:09 +00:00
parent 589274903d
commit f33137ea66
2 changed files with 9 additions and 0 deletions

View File

@@ -1,6 +1,12 @@
14 Jan 2010 - 2.5.12 14 Jan 2010 - 2.5.12
-------------------- --------------------
* Fixed failure to match internally set TX variables with regex
(TX:/.../) syntax.
* Fixed failure to log full internal TX variable names and populate
MATCHED_VAR* vars.
* Enabled PCRE "studying" by default. This is now a configure-time option. * Enabled PCRE "studying" by default. This is now a configure-time option.
* Added PCRE match limits (SecPcreMatchLimit/SecPcreMatchLimitRecursion) to * Added PCRE match limits (SecPcreMatchLimit/SecPcreMatchLimitRecursion) to

View File

@@ -176,6 +176,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string));
if (s == NULL) return -1; if (s == NULL) return -1;
s->name = apr_psprintf(msr->mp, "%d", i); s->name = apr_psprintf(msr->mp, "%d", i);
s->name_len = strlen(s->name);
s->value = apr_pstrmemdup(msr->mp, s->value = apr_pstrmemdup(msr->mp,
target + ovector[2*i], ovector[2*i + 1] - ovector[2*i]); target + ovector[2*i], ovector[2*i + 1] - ovector[2*i]);
s->value_len = (ovector[2*i + 1] - ovector[2*i]); s->value_len = (ovector[2*i + 1] - ovector[2*i]);
@@ -380,6 +381,7 @@ static int msre_op_pm_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
if (s == NULL) return -1; if (s == NULL) return -1;
s->name = "0"; s->name = "0";
s->name_len = strlen(s->name);
s->value = apr_pstrdup(msr->mp, match); s->value = apr_pstrdup(msr->mp, match);
if (s->value == NULL) return -1; if (s->value == NULL) return -1;
s->value_len = strlen(s->value); s->value_len = strlen(s->value);
@@ -1166,6 +1168,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string));
if (s == NULL) return -1; if (s == NULL) return -1;
s->name = apr_psprintf(msr->mp, "%d", i); s->name = apr_psprintf(msr->mp, "%d", i);
s->name_len = strlen(s->name);
s->value = apr_pstrmemdup(msr->mp, match, length); s->value = apr_pstrmemdup(msr->mp, match, length);
s->value_len = length; s->value_len = length;
if ((s->name == NULL)||(s->value == NULL)) return -1; if ((s->name == NULL)||(s->value == NULL)) return -1;