Skip to content

Commit 7c19ffe

Browse files
defanatorFelipe Zimmerle
authored and
Felipe Zimmerle
committed
Implemented merge_bodylimitaction_value() for BodyLimitAction
This change makes the following directives to be merged properly: SecRequestBodyLimitAction SecResponseBodyLimitAction
1 parent 3c41751 commit 7c19ffe

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

headers/modsecurity/rules_properties.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
to = (from == PropertyNotSetRuleEngine) ? default : from; \
4848
}
4949

50+
#define merge_bodylimitaction_value(to, from, default) \
51+
if (to == PropertyNotSetBodyLimitAction) { \
52+
to = (from == PropertyNotSetBodyLimitAction) ? default : from; \
53+
}
54+
5055
#ifdef __cplusplus
5156

5257
namespace modsecurity {
@@ -380,13 +385,13 @@ class RulesProperties {
380385
to->m_requestBodyLimit.merge(&from->m_requestBodyLimit);
381386
to->m_responseBodyLimit.merge(&from->m_responseBodyLimit);
382387

383-
if (from->m_requestBodyLimitAction != PropertyNotSetBodyLimitAction) {
384-
to->m_requestBodyLimitAction = from->m_requestBodyLimitAction;
385-
}
388+
merge_bodylimitaction_value(to->m_requestBodyLimitAction,
389+
from->m_requestBodyLimitAction,
390+
PropertyNotSetBodyLimitAction);
386391

387-
if (from->m_responseBodyLimitAction != PropertyNotSetBodyLimitAction) {
388-
to->m_responseBodyLimitAction = from->m_responseBodyLimitAction;
389-
}
392+
merge_bodylimitaction_value(to->m_responseBodyLimitAction,
393+
from->m_responseBodyLimitAction,
394+
PropertyNotSetBodyLimitAction);
390395

391396
to->m_uploadFileLimit.merge(&from->m_uploadFileLimit);
392397
to->m_uploadFileMode.merge(&from->m_uploadFileMode);

0 commit comments

Comments
 (0)