mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Cosmetics: Reduces the static analysis warnings
This commit is contained in:
parent
9c7416da97
commit
88fb456a16
@ -49,7 +49,6 @@ class Serial : public Writer {
|
|||||||
bool write(Transaction *transaction, int parts,
|
bool write(Transaction *transaction, int parts,
|
||||||
std::string *error) override;
|
std::string *error) override;
|
||||||
|
|
||||||
private:
|
|
||||||
void generateBoundary(std::string *boundary);
|
void generateBoundary(std::string *boundary);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ void Pm::cleanup(acmp_node_t *n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(n);
|
free(n);
|
||||||
n = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +75,6 @@ void Pm::postOrderTraversal(acmp_btree_node_t *node) {
|
|||||||
postOrderTraversal(node->left);
|
postOrderTraversal(node->left);
|
||||||
|
|
||||||
free(node);
|
free(node);
|
||||||
node = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ class Rbl : public Operator {
|
|||||||
/** @ingroup ModSecurity_Operator */
|
/** @ingroup ModSecurity_Operator */
|
||||||
Rbl(std::string op, std::string param, bool negation)
|
Rbl(std::string op, std::string param, bool negation)
|
||||||
: Operator(op, param, negation),
|
: Operator(op, param, negation),
|
||||||
m_demandsPassword(false),
|
m_service(param),
|
||||||
m_service(param) {
|
m_demandsPassword(false) {
|
||||||
m_provider = RblProvider::UnknownProvider;
|
m_provider = RblProvider::UnknownProvider;
|
||||||
if (m_service == "httpbl.org") {
|
if (m_service == "httpbl.org") {
|
||||||
m_demandsPassword = true;
|
m_demandsPassword = true;
|
||||||
|
@ -35,9 +35,9 @@ class ValidateSchema : public Operator {
|
|||||||
/** @ingroup ModSecurity_Operator */
|
/** @ingroup ModSecurity_Operator */
|
||||||
ValidateSchema(std::string o, std::string p, bool i)
|
ValidateSchema(std::string o, std::string p, bool i)
|
||||||
: Operator(o, p, i),
|
: Operator(o, p, i),
|
||||||
m_schema(NULL),
|
m_parserCtx(NULL),
|
||||||
m_validCtx(NULL),
|
m_validCtx(NULL),
|
||||||
m_parserCtx(NULL) { }
|
m_schema(NULL) { }
|
||||||
~ValidateSchema() {
|
~ValidateSchema() {
|
||||||
/*
|
/*
|
||||||
if (m_schema != NULL) {
|
if (m_schema != NULL) {
|
||||||
|
@ -28,7 +28,8 @@ namespace Parser {
|
|||||||
Driver::Driver()
|
Driver::Driver()
|
||||||
: RulesProperties(),
|
: RulesProperties(),
|
||||||
trace_scanning(false),
|
trace_scanning(false),
|
||||||
trace_parsing(false) {
|
trace_parsing(false),
|
||||||
|
lastRule(NULL) {
|
||||||
m_auditLog = new audit_log::AuditLog();
|
m_auditLog = new audit_log::AuditLog();
|
||||||
m_auditLog->refCountIncrease();
|
m_auditLog->refCountIncrease();
|
||||||
}
|
}
|
||||||
@ -116,7 +117,6 @@ int Driver::addSecRule(Rule *rule) {
|
|||||||
|
|
||||||
|
|
||||||
int Driver::parse(const std::string &f, const std::string &ref) {
|
int Driver::parse(const std::string &f, const std::string &ref) {
|
||||||
std::string error;
|
|
||||||
lastRule = NULL;
|
lastRule = NULL;
|
||||||
loc.push_back(new yy::location());
|
loc.push_back(new yy::location());
|
||||||
if (ref.empty()) {
|
if (ref.empty()) {
|
||||||
|
@ -59,8 +59,6 @@ class Driver : public RulesProperties {
|
|||||||
int addSecAction(Rule *rule);
|
int addSecAction(Rule *rule);
|
||||||
int addSecMarker(std::string marker);
|
int addSecMarker(std::string marker);
|
||||||
|
|
||||||
int result;
|
|
||||||
|
|
||||||
bool scan_begin();
|
bool scan_begin();
|
||||||
void scan_end();
|
void scan_end();
|
||||||
bool trace_scanning;
|
bool trace_scanning;
|
||||||
|
@ -36,33 +36,35 @@ namespace RequestBodyProcessor {
|
|||||||
|
|
||||||
|
|
||||||
Multipart::Multipart(std:: string header, Transaction *transaction)
|
Multipart::Multipart(std:: string header, Transaction *transaction)
|
||||||
: m_boundary_count(0),
|
: m_reqbody_no_files_length(0),
|
||||||
|
m_nfiles(0),
|
||||||
|
m_boundary_count(0),
|
||||||
|
m_buf{0},
|
||||||
m_buf_contains_line(0),
|
m_buf_contains_line(0),
|
||||||
|
m_bufptr(NULL),
|
||||||
m_bufleft(0),
|
m_bufleft(0),
|
||||||
m_buf_offset(0),
|
m_buf_offset(0),
|
||||||
m_bufptr(NULL),
|
m_mpp(NULL),
|
||||||
m_flag_boundary_quoted(0),
|
|
||||||
m_flag_boundary_whitespace(0),
|
|
||||||
m_flag_crlf_line(0),
|
|
||||||
m_flag_data_after(0),
|
|
||||||
m_flag_data_before(0),
|
|
||||||
m_flag_error(0),
|
|
||||||
m_flag_file_limit_exceeded(0),
|
|
||||||
m_flag_header_folding(0),
|
|
||||||
m_flag_invalid_header_folding(0),
|
|
||||||
m_flag_invalid_part(0),
|
|
||||||
m_flag_invalid_quoting(0),
|
|
||||||
m_flag_lf_line(0),
|
|
||||||
m_flag_missing_semicolon(0),
|
|
||||||
m_flag_unmatched_boundary(0),
|
|
||||||
m_header(header),
|
|
||||||
m_is_complete(0),
|
|
||||||
m_mpp_state(0),
|
m_mpp_state(0),
|
||||||
m_nfiles(0),
|
m_reserve{0},
|
||||||
m_seen_data(0),
|
m_seen_data(0),
|
||||||
m_transaction(transaction),
|
m_is_complete(0),
|
||||||
m_reqbody_no_files_length(0)
|
m_flag_error(0),
|
||||||
{ }
|
m_flag_data_before(0),
|
||||||
|
m_flag_data_after(0),
|
||||||
|
m_flag_header_folding(0),
|
||||||
|
m_flag_boundary_quoted(0),
|
||||||
|
m_flag_lf_line(0),
|
||||||
|
m_flag_crlf_line(0),
|
||||||
|
m_flag_unmatched_boundary(0),
|
||||||
|
m_flag_boundary_whitespace(0),
|
||||||
|
m_flag_missing_semicolon(0),
|
||||||
|
m_flag_invalid_quoting(0),
|
||||||
|
m_flag_invalid_part(0),
|
||||||
|
m_flag_invalid_header_folding(0),
|
||||||
|
m_flag_file_limit_exceeded(0),
|
||||||
|
m_header(header),
|
||||||
|
m_transaction(transaction) { }
|
||||||
|
|
||||||
|
|
||||||
Multipart::~Multipart() {
|
Multipart::~Multipart() {
|
||||||
@ -398,7 +400,7 @@ int Multipart::parse_content_disposition(const char *c_d_value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Multipart::tmp_file_name(std::string *filename) {
|
int Multipart::tmp_file_name(std::string *filename) const {
|
||||||
std::string path;
|
std::string path;
|
||||||
struct tm timeinfo;
|
struct tm timeinfo;
|
||||||
char tstr[300];
|
char tstr[300];
|
||||||
@ -1197,7 +1199,7 @@ bool Multipart::init(std::string *error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Case-insensitive test for the string "boundary" in the boundary. */
|
/* Case-insensitive test for the string "boundary" in the boundary. */
|
||||||
if (count_boundary_params(m_boundary.c_str()) != 0) {
|
if (count_boundary_params(m_boundary) != 0) {
|
||||||
m_flag_error = 1;
|
m_flag_error = 1;
|
||||||
debug(4, "Multipart: Invalid boundary in C-T (content).");
|
debug(4, "Multipart: Invalid boundary in C-T (content).");
|
||||||
error->assign("Multipart: Invalid boundary in C-T (content).");
|
error->assign("Multipart: Invalid boundary in C-T (content).");
|
||||||
|
@ -113,7 +113,7 @@ class Multipart {
|
|||||||
int process_part_header(std::string *error);
|
int process_part_header(std::string *error);
|
||||||
int process_part_data(std::string *error);
|
int process_part_data(std::string *error);
|
||||||
|
|
||||||
int tmp_file_name(std::string *filename);
|
int tmp_file_name(std::string *filename) const;
|
||||||
|
|
||||||
void validate_quotes(const char *data);
|
void validate_quotes(const char *data);
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ void IpTree::postOrderTraversal(TreeNode *node) {
|
|||||||
node->prefix = NULL;
|
node->prefix = NULL;
|
||||||
}
|
}
|
||||||
free(node);
|
free(node);
|
||||||
node = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
unusedFunction:test/regression/regression_test.cc
|
||||||
|
unusedFunction:src/utils/string.cc
|
||||||
unusedFunction:src/transaction.cc
|
unusedFunction:src/transaction.cc
|
||||||
unusedFunction:src/utils/mbedtls/sha1.c
|
unusedFunction:src/utils/mbedtls/sha1.c
|
||||||
unusedFunction:src/utils/mbedtls/md5.c
|
unusedFunction:src/utils/mbedtls/md5.c
|
||||||
|
@ -23,10 +23,6 @@
|
|||||||
|
|
||||||
namespace modsecurity_test {
|
namespace modsecurity_test {
|
||||||
|
|
||||||
CustomDebugLog *CustomDebugLog::new_instance() {
|
|
||||||
return new CustomDebugLog();
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomDebugLog::~CustomDebugLog() { }
|
CustomDebugLog::~CustomDebugLog() { }
|
||||||
|
|
||||||
void CustomDebugLog::write(int level, const std::string& message) {
|
void CustomDebugLog::write(int level, const std::string& message) {
|
||||||
|
@ -380,7 +380,9 @@ after_debug_log:
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
ModSecurityTest<RegressionTest> test;
|
ModSecurityTest<RegressionTest> test;
|
||||||
|
#ifndef NO_LOGS
|
||||||
int test_number = 0;
|
int test_number = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_GEOIP
|
#ifdef WITH_GEOIP
|
||||||
resources.push_back("geoip");
|
resources.push_back("geoip");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user