diff --git a/src/actions/set_var.cc b/src/actions/set_var.cc index e543f63e..496455dd 100644 --- a/src/actions/set_var.cc +++ b/src/actions/set_var.cc @@ -122,13 +122,10 @@ bool SetVar::evaluate(Rule *rule, Transaction *transm_parser_payload) { value = 0; } - switch (m_operation) { - case sumAndSetOperation: - targetValue = std::to_string(value + pre); - break; - case substractAndSetOperation: - targetValue = std::to_string(value - pre); - break; + if (m_operation == sumAndSetOperation) { + targetValue = std::to_string(value + pre); + } else if (m_operation == substractAndSetOperation) { + targetValue = std::to_string(value - pre); } } diff --git a/src/actions/status.h b/src/actions/status.h index f1db8146..c7d9c0bc 100644 --- a/src/actions/status.h +++ b/src/actions/status.h @@ -31,7 +31,7 @@ class Status : public Action { public: explicit Status(std::string action) : Action(action, 2) { } - bool init(std::string *error); + bool init(std::string *error) override; bool evaluate(Rule *rule, Transaction *transaction) override; void fillIntervention(ModSecurityIntervention *i) override; diff --git a/src/rules_exceptions.cc b/src/rules_exceptions.cc index c6a083ef..e2cd22bb 100644 --- a/src/rules_exceptions.cc +++ b/src/rules_exceptions.cc @@ -68,11 +68,13 @@ bool RulesExceptions::load(const std::string &a, std::string *error) { bool RulesExceptions::addNumber(int a) { m_numbers.push_back(a); + return true; } bool RulesExceptions::addRange(int a, int b) { m_ranges.push_back(std::make_pair(a, b)); + return true; } diff --git a/src/utils.cc b/src/utils.cc index 323ed879..34e7729e 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -322,13 +322,13 @@ void createDir(std::string dir, int mode) { double cpu_seconds(void) { struct timespec t; - if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t)) return static_cast(t.tv_sec) + static_cast(t.tv_nsec / 1000000000.0); else return static_cast(clock()) / static_cast(CLOCKS_PER_SEC); + return 0; } @@ -642,7 +642,7 @@ length: * Converts a single hexadecimal digit into a decimal value. */ unsigned char xsingle2c(unsigned char *what) { - register unsigned char digit; + unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); @@ -651,7 +651,7 @@ unsigned char xsingle2c(unsigned char *what) { unsigned char x2c(unsigned char *what) { - register unsigned char digit; + unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16;