Skip to content

Commit 3ed9115

Browse files
Kansei-Sakurakanseiishikawa
authored andcommitted
fix SonarCloud Code Error
1 parent 4efb67e commit 3ed9115

7 files changed

Lines changed: 17 additions & 6 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#line 3 "seclang-scanner.cc"
23

34
#define YY_INT_ALIGNED short int
@@ -8400,7 +8401,7 @@ YY_RULE_SETUP
84008401
driver.loc.push_back(new yy::location());
84018402
driver.m_filenames.push_back(f);
84028403
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) {
8404+
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) { // NOSONAR
84048405
BEGIN(INITIAL);
84058406
driver.loc.pop_back();
84068407
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file. ") + err);
@@ -8431,8 +8432,7 @@ YY_RULE_SETUP
84318432
driver.loc.push_back(new yy::location());
84328433
driver.m_filenames.push_back(f);
84338434
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) {
8435+
if (!modsecurity::utils::fopen_modsec(&yyin, f.c_str(), "r") != 0) { // NOSONAR
84368436
BEGIN(INITIAL);
84378437
driver.loc.pop_back();
84388438
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file. ") + err);

src/parser/seclang-scanner.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* -*- C++ -*- */
1+
%{ /* -*- C++ -*- */
22
#include <cerrno>
33
#include <climits>
44
#include <cstdlib>

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)