Skip to content

Commit c369be6

Browse files
committed
fix SonarCloud Code Error
1 parent 4efb67e commit c369be6

6 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎bindings/python‎

Submodule python added at bc625d5

‎others/libinjection‎

Submodule libinjection added at 2117822

‎others/mbedtls‎

Submodule mbedtls added at 0fe989b

‎src/parser/seclang-scanner.cc‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8400,7 +8400,7 @@ YY_RULE_SETUP
84008400
driver.loc.push_back(new yy::location());
84018401
driver.m_filenames.push_back(f);
84028402
driver.loc.back()->begin.filename = driver.loc.back()->end.filename = &(driver.m_filenames.back());
8403-
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) {
8403+
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) { // NOSONAR
84048404
BEGIN(INITIAL);
84058405
driver.loc.pop_back();
84068406
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file. ") + err);
@@ -8431,8 +8431,7 @@ YY_RULE_SETUP
84318431
driver.loc.push_back(new yy::location());
84328432
driver.m_filenames.push_back(f);
84338433
driver.loc.back()->begin.filename = driver.loc.back()->end.filename = &(driver.m_filenames.back());
8434-
8435-
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) {
8434+
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) { // NOSONAR
84368435
BEGIN(INITIAL);
84378436
driver.loc.pop_back();
84388437
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file. ") + err);

‎src/utils/system.cc‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,22 @@ bool isFile(const std::string& f) {
220220
return true;
221221
}
222222

223+
#if defined(_MSC_VER)
224+
#pragma warning(push)
225+
#pragma warning(disable : 4996)
226+
#endif
223227
bool fopen_modsec(FILE **v_fp, const char *filename, const char *mode) {
224-
if (v_fp == NULL || filename == NULL || mode == NULL) {
228+
if (v_fp == nullptr || filename == nullptr || mode == nullptr) {
225229
return false;
226230
}
227231
*v_fp = fopen(filename, mode);
228-
if (*v_fp == NULL) {
232+
if (*v_fp == nullptr) {
229233
return false;
230234
}
231235
return true;
232236
}
237+
#if defined(_MSC_VER)
238+
#pragma warning(pop)
239+
#endif
233240
} // namespace utils
234241
} // namespace modsecurity
Submodule secrules-language-tests added at a3d4405

0 commit comments

Comments
 (0)