From 40fbc985b10feb70b969ea740e9beec8231e1b24 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Sun, 28 Apr 2024 11:34:37 -0300 Subject: [PATCH] Inline cppcheck suppressions --- src/operators/validate_url_encoding.cc | 2 +- src/operators/verify_svnr.cc | 2 +- src/rules_set_properties.cc | 4 ++-- test/cppcheck_suppressions.txt | 4 ---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/operators/validate_url_encoding.cc b/src/operators/validate_url_encoding.cc index 20a86eb625..502aa3d49e 100644 --- a/src/operators/validate_url_encoding.cc +++ b/src/operators/validate_url_encoding.cc @@ -74,7 +74,7 @@ bool ValidateUrlEncoding::evaluate(Transaction *transaction, RuleWithActions *ru bool res = false; if (input.empty() == true) { - return res; + return res; // cppcheck-suppress knownConditionTrueFalse } int rc = validate_url_encoding(input.c_str(), input.size(), &offset); diff --git a/src/operators/verify_svnr.cc b/src/operators/verify_svnr.cc index 248e6b4ec1..8da15d886e 100644 --- a/src/operators/verify_svnr.cc +++ b/src/operators/verify_svnr.cc @@ -84,7 +84,7 @@ bool VerifySVNR::evaluate(Transaction *t, RuleWithActions *rule, int i; if (m_param.empty()) { - return is_svnr; + return is_svnr; // cppcheck-suppress knownConditionTrueFalse } for (i = 0; i < input.size() - 1 && is_svnr == false; i++) { diff --git a/src/rules_set_properties.cc b/src/rules_set_properties.cc index 68acae7c9b..80078b3dd2 100644 --- a/src/rules_set_properties.cc +++ b/src/rules_set_properties.cc @@ -102,8 +102,8 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage, if (mapping != NULL) { ucode = strtok_r(mapping, ":", &hmap); - sscanf(ucode, "%x", &code); - sscanf(hmap, "%x", &Map); + sscanf(ucode, "%x", &code); // cppcheck-suppress invalidScanfArgType_int + sscanf(hmap, "%x", &Map); // cppcheck-suppress invalidScanfArgType_int if (code >= 0 && code <= 65535) { driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map); } diff --git a/test/cppcheck_suppressions.txt b/test/cppcheck_suppressions.txt index e8e66f1fb4..9c09eb19c1 100644 --- a/test/cppcheck_suppressions.txt +++ b/test/cppcheck_suppressions.txt @@ -25,8 +25,6 @@ shiftNegative:src/utils/msc_tree.cc *:src/utils/acmp.cc *:src/utils/msc_tree.cc -invalidScanfArgType_int:src/rules_set_properties.cc:105 -invalidScanfArgType_int:src/rules_set_properties.cc:106 // @@ -46,8 +44,6 @@ functionStatic:src/operators/geo_lookup.h:35 duplicateBreak:src/operators/validate_utf8_encoding.cc syntaxError:src/transaction.cc:65 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:src/rule_with_actions.cc:127 ctunullpointer:src/rule_with_actions.cc:242