mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Don't store empty string before macro and empty macro result
This commit is contained in:
parent
608cd1d09d
commit
31dae62f41
@ -228,18 +228,20 @@ int expand_macros(modsec_rec *msr, msc_string *var, msre_rule *rule, apr_pool_t
|
|||||||
msre_var *var_resolved = NULL;
|
msre_var *var_resolved = NULL;
|
||||||
|
|
||||||
/* Add the text part before the macro to the array. */
|
/* Add the text part before the macro to the array. */
|
||||||
|
if (p != text_start) {
|
||||||
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
||||||
if (part == NULL) return -1;
|
if (part == NULL) return -1;
|
||||||
part->value_len = p - text_start;
|
part->value_len = p - text_start;
|
||||||
part->value = apr_pstrmemdup(mptmp, text_start, part->value_len);
|
part->value = apr_pstrmemdup(mptmp, text_start, part->value_len);
|
||||||
*(msc_string **)apr_array_push(arr) = part;
|
*(msc_string **)apr_array_push(arr) = part;
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve the macro and add that to the array. */
|
/* Resolve the macro and add that to the array. */
|
||||||
var_resolved = msre_create_var_ex(mptmp, msr->modsecurity->msre, var_name, var_value,
|
var_resolved = msre_create_var_ex(mptmp, msr->modsecurity->msre, var_name, var_value,
|
||||||
msr, &my_error_msg);
|
msr, &my_error_msg);
|
||||||
if (var_resolved != NULL) {
|
if (var_resolved != NULL) {
|
||||||
var_generated = generate_single_var(msr, var_resolved, NULL, rule, mptmp);
|
var_generated = generate_single_var(msr, var_resolved, NULL, rule, mptmp);
|
||||||
if (var_generated != NULL) {
|
if (var_generated != NULL && var_generated->value_len) {
|
||||||
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
||||||
if (part == NULL) return -1;
|
if (part == NULL) return -1;
|
||||||
part->value_len = var_generated->value_len;
|
part->value_len = var_generated->value_len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user