mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Cosmetics: address cppcheck warnings
This commit is contained in:
@@ -237,10 +237,10 @@ int JSON::yajl_end_array(void *ctx) {
|
||||
tthis->m_containers.pop_back();
|
||||
delete a;
|
||||
if (tthis->m_containers.size() > 0) {
|
||||
JSONContainerArray *a = dynamic_cast<JSONContainerArray *>(
|
||||
JSONContainerArray *ja = dynamic_cast<JSONContainerArray *>(
|
||||
tthis->m_containers.back());
|
||||
if (a) {
|
||||
a->m_elementCounter++;
|
||||
if (ja) {
|
||||
ja->m_elementCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,10 +272,10 @@ int JSON::yajl_end_map(void *ctx) {
|
||||
delete a;
|
||||
|
||||
if (tthis->m_containers.size() > 0) {
|
||||
JSONContainerArray *a = dynamic_cast<JSONContainerArray *>(
|
||||
JSONContainerArray *ja = dynamic_cast<JSONContainerArray *>(
|
||||
tthis->m_containers.back());
|
||||
if (a) {
|
||||
a->m_elementCounter++;
|
||||
if (ja) {
|
||||
ja->m_elementCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ namespace RequestBodyProcessor {
|
||||
|
||||
class JSONContainer {
|
||||
public:
|
||||
explicit JSONContainer(std::string name) : m_name(name) { }
|
||||
explicit JSONContainer(const std::string &name) : m_name(name) { }
|
||||
virtual ~JSONContainer() { }
|
||||
std::string m_name;
|
||||
};
|
||||
@@ -44,7 +44,7 @@ class JSONContainer {
|
||||
|
||||
class JSONContainerArray : public JSONContainer {
|
||||
public:
|
||||
explicit JSONContainerArray(std::string name) : JSONContainer(name),
|
||||
explicit JSONContainerArray(const std::string &name) : JSONContainer(name),
|
||||
m_elementCounter(0) { }
|
||||
size_t m_elementCounter;
|
||||
};
|
||||
@@ -52,7 +52,7 @@ class JSONContainerArray : public JSONContainer {
|
||||
|
||||
class JSONContainerMap : public JSONContainer {
|
||||
public:
|
||||
explicit JSONContainerMap(std::string name) : JSONContainer(name) { }
|
||||
explicit JSONContainerMap(const std::string &name) : JSONContainer(name) { }
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class JSON {
|
||||
explicit JSON(Transaction *transaction);
|
||||
~JSON();
|
||||
|
||||
bool init();
|
||||
static bool init();
|
||||
bool processChunk(const char *buf, unsigned int size, std::string *err);
|
||||
bool complete(std::string *err);
|
||||
|
||||
@@ -79,7 +79,7 @@ class JSON {
|
||||
static int yajl_start_array(void *ctx);
|
||||
static int yajl_end_array(void *ctx);
|
||||
|
||||
bool isPreviousArray() {
|
||||
bool isPreviousArray() const {
|
||||
JSONContainerArray *prev = NULL;
|
||||
if (m_containers.size() < 1) {
|
||||
return false;
|
||||
|
@@ -36,7 +36,7 @@ namespace modsecurity {
|
||||
namespace RequestBodyProcessor {
|
||||
|
||||
|
||||
Multipart::Multipart(std:: string header, Transaction *transaction)
|
||||
Multipart::Multipart(const std::string &header, Transaction *transaction)
|
||||
: m_reqbody_no_files_length(0),
|
||||
m_nfiles(0),
|
||||
m_boundary_count(0),
|
||||
@@ -1277,7 +1277,7 @@ bool Multipart::init(std::string *error) {
|
||||
/* Quoted. */
|
||||
m_boundary.assign(std::string(b + 1, len - 2));
|
||||
if (m_boundary.empty()) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
m_flag_boundary_quoted = 1;
|
||||
} else {
|
||||
|
@@ -58,11 +58,19 @@ class MultipartPart {
|
||||
public:
|
||||
MultipartPart()
|
||||
: m_type(MULTIPART_FORMDATA),
|
||||
m_tmp_file_fd(0),
|
||||
m_offset(0),
|
||||
m_filenameOffset(0),
|
||||
m_name(""),
|
||||
m_nameOffset(0),
|
||||
m_value(""),
|
||||
m_valueOffset(0),
|
||||
m_value_parts(),
|
||||
m_tmp_file_name(""),
|
||||
m_tmp_file_fd(0),
|
||||
m_tmp_file_size(),
|
||||
m_filename(""),
|
||||
m_filenameOffset(0),
|
||||
m_last_header_name(""),
|
||||
m_headers(),
|
||||
m_offset(0),
|
||||
m_length(0) {
|
||||
m_tmp_file_size.first = 0;
|
||||
m_tmp_file_size.second = 0;
|
||||
@@ -109,14 +117,14 @@ class MultipartPart {
|
||||
|
||||
class Multipart {
|
||||
public:
|
||||
Multipart(std::string header, Transaction *transaction);
|
||||
Multipart(const std::string &header, Transaction *transaction);
|
||||
~Multipart();
|
||||
|
||||
bool init(std::string *err);
|
||||
|
||||
int boundary_characters_valid(const char *boundary);
|
||||
int count_boundary_params(const std::string& str_header_value);
|
||||
int is_token_char(unsigned char c);
|
||||
static int boundary_characters_valid(const char *boundary);
|
||||
static int count_boundary_params(const std::string& str_header_value);
|
||||
static int is_token_char(unsigned char c);
|
||||
int multipart_complete(std::string *err);
|
||||
|
||||
int parse_content_disposition(const char *c_d_value, int offset);
|
||||
|
@@ -46,13 +46,13 @@ XML::~XML() {
|
||||
|
||||
|
||||
bool XML::init() {
|
||||
xmlParserInputBufferCreateFilenameFunc entity;
|
||||
//xmlParserInputBufferCreateFilenameFunc entity;
|
||||
if (m_transaction->m_rules->m_secXMLExternalEntity
|
||||
== RulesProperties::TrueConfigBoolean) {
|
||||
entity = xmlParserInputBufferCreateFilenameDefault(
|
||||
/*entity = */xmlParserInputBufferCreateFilenameDefault(
|
||||
__xmlParserInputBufferCreateFilename);
|
||||
} else {
|
||||
entity = xmlParserInputBufferCreateFilenameDefault(
|
||||
/*entity = */xmlParserInputBufferCreateFilenameDefault(
|
||||
this->unloadExternalEntity);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user