mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Add cppcheck suppressions for false positives
This commit is contained in:
parent
c2b86ddc49
commit
d053ec6de6
@ -22,7 +22,7 @@ namespace modsecurity::actions::transformations {
|
||||
static inline bool inplace(std::string &value) {
|
||||
if (value.empty()) return false;
|
||||
|
||||
for(auto &c : value) {
|
||||
for(auto &c : value) { // cppcheck-suppress constVariableReference ; false positive
|
||||
((unsigned char&)c) &= 0x7f;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define pclose _pclose
|
||||
|
||||
inline tm* localtime_r(const time_t* tin, tm* tout) {
|
||||
// cppcheck-suppress[uninitvar, ctuuninitvar]
|
||||
if (!localtime_s(tout, tin)) return tout;
|
||||
|
||||
return nullptr;
|
||||
|
@ -102,9 +102,9 @@ RuleWithActions::RuleWithActions(
|
||||
delete a;
|
||||
} else if (auto sa = dynamic_cast<actions::Severity *>(a)) {
|
||||
m_severity = sa;
|
||||
} else if (auto lda = dynamic_cast<actions::LogData *>(a)) {
|
||||
} else if (auto lda = dynamic_cast<actions::LogData *>(a)) { // cppcheck-suppress unreadVariable ; false positive
|
||||
m_logData = lda;
|
||||
} else if (auto ma = dynamic_cast<actions::Msg *>(a)) {
|
||||
} else if (auto ma = dynamic_cast<actions::Msg *>(a)) { // cppcheck-suppress unreadVariable ; false positive
|
||||
m_msg = ma;
|
||||
} else if (auto sva = dynamic_cast<actions::SetVar *>(a)) {
|
||||
m_actionsSetVar.push_back(sva);
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "mbedtls/base64.h"
|
||||
|
||||
template<typename Operation>
|
||||
inline std::string base64Helper(const char *data, const unsigned int len, Operation op) {
|
||||
inline std::string base64Helper(const char *data, const unsigned int len, Operation op) { // cppcheck-suppress syntaxError ; false positive
|
||||
size_t out_len = 0;
|
||||
|
||||
op(nullptr, 0, &out_len,
|
||||
|
@ -257,7 +257,7 @@ inline std::string string_to_hex(std::string_view input) {
|
||||
|
||||
|
||||
template<typename Operation>
|
||||
inline std::string toCaseHelper(std::string str, Operation op) {
|
||||
inline std::string toCaseHelper(std::string str, Operation op) { // cppcheck-suppress syntaxError ; false positive
|
||||
std::transform(str.begin(),
|
||||
str.end(),
|
||||
str.begin(),
|
||||
|
@ -105,7 +105,7 @@ struct TransformationTest {
|
||||
|
||||
|
||||
template<typename TestType>
|
||||
UnitTestResult perform_unit_test_once(const UnitTest &t, modsecurity::Transaction &transaction) {
|
||||
UnitTestResult perform_unit_test_once(const UnitTest &t, modsecurity::Transaction &transaction) { // cppcheck-suppress constParameterReference ; transaction can be const for transformations but not for operators
|
||||
std::unique_ptr<typename TestType::ItemType> item(TestType::init(t));
|
||||
assert(item.get() != nullptr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user