mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Inline cppcheck suppressions
This commit is contained in:
parent
0c38023b21
commit
4aad8e0d06
@ -405,7 +405,7 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
|
|||||||
size_t getRequestBodyLength();
|
size_t getRequestBodyLength();
|
||||||
|
|
||||||
#ifndef NO_LOGS
|
#ifndef NO_LOGS
|
||||||
void debug(int, const std::string&) const;
|
void debug(int, const std::string &) const; // cppcheck-suppress functionStatic
|
||||||
#endif
|
#endif
|
||||||
void serverLog(std::shared_ptr<RuleMessage> rm);
|
void serverLog(std::shared_ptr<RuleMessage> rm);
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ class Lua {
|
|||||||
public:
|
public:
|
||||||
Lua() { }
|
Lua() { }
|
||||||
|
|
||||||
bool load(const std::string &script, std::string *err);
|
bool load(const std::string &script, std::string *err); // cppcheck-suppress functionStatic ; triggered when compiling without LUA
|
||||||
int run(Transaction *t, const std::string &str="");
|
int run(Transaction *t, const std::string &str = ""); // cppcheck-suppress functionStatic ; triggered when compiling without LUA
|
||||||
static bool isCompatible(const std::string &script, Lua *l, std::string *error);
|
static bool isCompatible(const std::string &script, Lua *l, std::string *error);
|
||||||
|
|
||||||
#ifdef WITH_LUA
|
#ifdef WITH_LUA
|
||||||
|
@ -32,6 +32,7 @@ class GeoLookup : public Operator {
|
|||||||
bool evaluate(Transaction *transaction, const std::string &exp) override;
|
bool evaluate(Transaction *transaction, const std::string &exp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// cppcheck-suppress functionStatic
|
||||||
bool debug(Transaction *transaction, int x, const std::string &a) {
|
bool debug(Transaction *transaction, int x, const std::string &a) {
|
||||||
ms_dbg_a(transaction, x, a);
|
ms_dbg_a(transaction, x, a);
|
||||||
return true;
|
return true;
|
||||||
|
@ -66,8 +66,9 @@ class Rbl : public Operator {
|
|||||||
m_demandsPassword(false),
|
m_demandsPassword(false),
|
||||||
m_provider(RblProvider::UnknownProvider),
|
m_provider(RblProvider::UnknownProvider),
|
||||||
Operator("Rbl", std::move(param)) {
|
Operator("Rbl", std::move(param)) {
|
||||||
m_service = m_string->evaluate();
|
m_service = m_string->evaluate(); // cppcheck-suppress useInitializationList
|
||||||
if (m_service.find("httpbl.org") != std::string::npos) {
|
if (m_service.find("httpbl.org") != std::string::npos)
|
||||||
|
{
|
||||||
m_demandsPassword = true;
|
m_demandsPassword = true;
|
||||||
m_provider = RblProvider::httpbl;
|
m_provider = RblProvider::httpbl;
|
||||||
} else if (m_service.find("uribl.com") != std::string::npos) {
|
} else if (m_service.find("uribl.com") != std::string::npos) {
|
||||||
|
@ -74,7 +74,7 @@ bool ValidateUrlEncoding::evaluate(Transaction *transaction, RuleWithActions *ru
|
|||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (input.empty() == true) {
|
if (input.empty() == true) {
|
||||||
return res;
|
return res; // cppcheck-suppress knownConditionTrueFalse
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = validate_url_encoding(input.c_str(), input.size(), &offset);
|
int rc = validate_url_encoding(input.c_str(), input.size(), &offset);
|
||||||
|
@ -74,7 +74,7 @@ bool VerifyCPF::verify(const char *cpfnumber, int len) {
|
|||||||
c = cpf_len;
|
c = cpf_len;
|
||||||
|
|
||||||
for (i = 0; i < 9; i++) {
|
for (i = 0; i < 9; i++) {
|
||||||
sum += (cpf[i] * --c);
|
sum += (cpf[i] * --c); // cppcheck-suppress uninitvar
|
||||||
}
|
}
|
||||||
|
|
||||||
factor = (sum % cpf_len);
|
factor = (sum % cpf_len);
|
||||||
|
@ -64,7 +64,7 @@ bool VerifySVNR::verify(const char *svnrnumber, int len) {
|
|||||||
}
|
}
|
||||||
//Laufnummer mit 3, 7, 9
|
//Laufnummer mit 3, 7, 9
|
||||||
//Geburtsdatum mit 5, 8, 4, 2, 1, 6
|
//Geburtsdatum mit 5, 8, 4, 2, 1, 6
|
||||||
sum = svnr[0] * 3 + svnr[1] * 7 + svnr[2] * 9 + svnr[4] * 5 + svnr[5] * 8 + svnr[6] * 4 + svnr[7] * 2 + svnr[8] * 1 + svnr[9] * 6;
|
sum = svnr[0] * 3 + svnr[1] * 7 + svnr[2] * 9 + svnr[4] * 5 + svnr[5] * 8 + svnr[6] * 4 + svnr[7] * 2 + svnr[8] * 1 + svnr[9] * 6; // cppcheck-suppress uninitvar
|
||||||
sum %= 11;
|
sum %= 11;
|
||||||
if(sum == 10){
|
if(sum == 10){
|
||||||
sum = 0;
|
sum = 0;
|
||||||
@ -84,7 +84,7 @@ bool VerifySVNR::evaluate(Transaction *t, RuleWithActions *rule,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (m_param.empty()) {
|
if (m_param.empty()) {
|
||||||
return is_svnr;
|
return is_svnr; // cppcheck-suppress knownConditionTrueFalse
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < input.size() - 1 && is_svnr == false; i++) {
|
for (i = 0; i < input.size() - 1 && is_svnr == false; i++) {
|
||||||
|
@ -241,7 +241,7 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans,
|
|||||||
bool containsBlock, std::shared_ptr<RuleMessage> ruleMessage) {
|
bool containsBlock, std::shared_ptr<RuleMessage> ruleMessage) {
|
||||||
bool disruptiveAlreadyExecuted = false;
|
bool disruptiveAlreadyExecuted = false;
|
||||||
|
|
||||||
for (auto &a : trans->m_rules->m_defaultActions[getPhase()]) {
|
for (auto &a : trans->m_rules->m_defaultActions[getPhase()]) { // cppcheck-suppress ctunullpointer
|
||||||
if (a.get()->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
|
if (a.get()->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ void RuleWithOperator::updateMatchedVars(Transaction *trans, const std::string &
|
|||||||
|
|
||||||
void RuleWithOperator::cleanMatchedVars(Transaction *trans) {
|
void RuleWithOperator::cleanMatchedVars(Transaction *trans) {
|
||||||
ms_dbg_a(trans, 9, "Matched vars cleaned.");
|
ms_dbg_a(trans, 9, "Matched vars cleaned.");
|
||||||
|
// cppcheck-suppress ctunullpointer
|
||||||
trans->m_variableMatchedVar.unset();
|
trans->m_variableMatchedVar.unset();
|
||||||
trans->m_variableMatchedVars.unset();
|
trans->m_variableMatchedVars.unset();
|
||||||
trans->m_variableMatchedVarName.unset();
|
trans->m_variableMatchedVarName.unset();
|
||||||
@ -132,7 +133,7 @@ bool RuleWithOperator::executeOperatorAt(Transaction *trans, const std::string &
|
|||||||
|
|
||||||
void RuleWithOperator::getVariablesExceptions(Transaction *t,
|
void RuleWithOperator::getVariablesExceptions(Transaction *t,
|
||||||
variables::Variables *exclusion, variables::Variables *addition) {
|
variables::Variables *exclusion, variables::Variables *addition) {
|
||||||
for (auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_tag) {
|
for (auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_tag) { // cppcheck-suppress ctunullpointer
|
||||||
if (containsTag(*a.first.get(), t) == false) {
|
if (containsTag(*a.first.get(), t) == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -98,8 +98,8 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
|
|||||||
|
|
||||||
if (mapping != NULL) {
|
if (mapping != NULL) {
|
||||||
ucode = strtok_r(mapping, ":", &hmap);
|
ucode = strtok_r(mapping, ":", &hmap);
|
||||||
sscanf(ucode, "%x", &code);
|
sscanf(ucode, "%x", &code); // cppcheck-suppress invalidScanfArgType_int
|
||||||
sscanf(hmap, "%x", &Map);
|
sscanf(hmap, "%x", &Map); // cppcheck-suppress invalidScanfArgType_int
|
||||||
if (code >= 0 && code <= 65535) {
|
if (code >= 0 && code <= 65535) {
|
||||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map);
|
driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map);
|
||||||
}
|
}
|
||||||
|
@ -25,36 +25,19 @@
|
|||||||
shiftNegative:src/utils/msc_tree.cc
|
shiftNegative:src/utils/msc_tree.cc
|
||||||
*:src/utils/acmp.cc
|
*:src/utils/acmp.cc
|
||||||
*:src/utils/msc_tree.cc
|
*:src/utils/msc_tree.cc
|
||||||
invalidScanfArgType_int:src/rules_set_properties.cc:101
|
|
||||||
invalidScanfArgType_int:src/rules_set_properties.cc:102
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ModSecurity v3 code...
|
// ModSecurity v3 code...
|
||||||
//
|
//
|
||||||
useInitializationList:src/utils/shared_files.h:87
|
useInitializationList:src/utils/shared_files.h:87
|
||||||
functionStatic:headers/modsecurity/transaction.h:408
|
|
||||||
duplicateBranch:src/audit_log/audit_log.cc:226
|
duplicateBranch:src/audit_log/audit_log.cc:226
|
||||||
unreadVariable:src/request_body_processor/multipart.cc:435
|
unreadVariable:src/request_body_processor/multipart.cc:435
|
||||||
stlcstrParam:src/audit_log/writer/parallel.cc:145
|
stlcstrParam:src/audit_log/writer/parallel.cc:145
|
||||||
functionStatic:src/engine/lua.h:70
|
|
||||||
functionStatic:src/engine/lua.h:71
|
|
||||||
functionConst:src/utils/geo_lookup.h:49
|
|
||||||
useInitializationList:src/operators/rbl.h:69
|
|
||||||
functionStatic:src/operators/geo_lookup.h:35
|
|
||||||
syntaxError:src/transaction.cc:62
|
syntaxError:src/transaction.cc:62
|
||||||
noConstructor:src/variables/variable.h:152
|
noConstructor:src/variables/variable.h:152
|
||||||
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:77
|
|
||||||
knownConditionTrueFalse:src/operators/verify_svnr.cc:87
|
|
||||||
rethrowNoCurrentException:headers/modsecurity/transaction.h:313
|
rethrowNoCurrentException:headers/modsecurity/transaction.h:313
|
||||||
rethrowNoCurrentException:src/rule_with_actions.cc:127
|
rethrowNoCurrentException:src/rule_with_actions.cc:127
|
||||||
ctunullpointer:src/rule_with_actions.cc:244
|
|
||||||
ctunullpointer:src/rule_with_operator.cc:135
|
|
||||||
ctunullpointer:src/rule_with_operator.cc:95
|
|
||||||
unreadVariable:src/rule_with_operator.cc:219
|
|
||||||
|
|
||||||
uninitvar:src/operators/verify_cpf.cc:77
|
|
||||||
uninitvar:src/operators/verify_svnr.cc:67
|
|
||||||
|
|
||||||
variableScope:src/operators/rx.cc
|
variableScope:src/operators/rx.cc
|
||||||
variableScope:src/operators/rx_global.cc
|
variableScope:src/operators/rx_global.cc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user