Skip to content

Fix SecRequestBody(NoFiles)Limit overflow #3419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: v3/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions headers/modsecurity/rules_set_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ using modsecurity::audit_log::AuditLog;
/** @ingroup ModSecurity_CPP_API */
class ConfigInt {
public:
ConfigInt() : m_set(false), m_value(0) { }
bool m_set;
int m_value;
bool m_set = false;
int m_value = 0;
ConfigInt() = default;

void merge(const ConfigInt *from) {
if (m_set == true || from->m_set == false) {
Expand All @@ -85,12 +85,28 @@ class ConfigInt {
}
};

class ConfigUnsignedInt {
public:
bool m_set = false;
unsigned int m_value = 0;
ConfigUnsignedInt() = default;

void merge(const ConfigUnsignedInt *from) {
if (m_set == true || from->m_set == false) {
return;
}
m_set = true;
m_value = from->m_value;
return;
}
};


class ConfigDouble {
public:
ConfigDouble() : m_set(false), m_value(0) { }
bool m_set;
double m_value;
bool m_set = false;
double m_value = 0.0;
ConfigDouble() = default;

void merge(const ConfigDouble *from) {
if (m_set == true || from->m_set == false) {
Expand All @@ -105,9 +121,9 @@ class ConfigDouble {

class ConfigString {
public:
ConfigString() : m_set(false), m_value("") { }
bool m_set;
std::string m_value;
bool m_set = false;
std::string m_value = "";
ConfigString() = default;

void merge(const ConfigString *from) {
if (m_set == true || from->m_set == false) {
Expand All @@ -122,10 +138,10 @@ class ConfigString {

class ConfigSet {
public:
ConfigSet() : m_set(false), m_clear(false) { }
bool m_set;
bool m_clear;
bool m_set = false;
bool m_clear = false;
std::set<std::string> m_value;
ConfigSet() = default;
};


Expand Down Expand Up @@ -506,9 +522,9 @@ class RulesSetProperties {
ConfigBoolean m_uploadKeepFiles;
ConfigDouble m_argumentsLimit;
ConfigDouble m_requestBodyJsonDepthLimit;
ConfigDouble m_requestBodyLimit;
ConfigDouble m_requestBodyNoFilesLimit;
ConfigDouble m_responseBodyLimit;
ConfigUnsignedInt m_requestBodyLimit;
ConfigUnsignedInt m_requestBodyNoFilesLimit;
ConfigUnsignedInt m_responseBodyLimit;
ConfigInt m_pcreMatchLimit;
ConfigInt m_uploadFileLimit;
ConfigInt m_uploadFileMode;
Expand Down
Loading
Loading