mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-12-31 21:59:11 +03:00
cosmetics: Fix compilation warnings to please QA
This commit is contained in:
committed by
Felipe Zimmerle
parent
7f31746ca2
commit
e0f39b3211
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
#include "modsecurity/rules_set.h"
|
||||
|
||||
|
||||
#ifdef MSC_DOCUMENTATION
|
||||
/**
|
||||
* Description: Assigns a tag (category) to a rule or a chain.
|
||||
*
|
||||
@@ -46,7 +46,7 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
@@ -34,11 +34,12 @@ void RemoveWhitespace::execute(const Transaction *t,
|
||||
ModSecString &out) noexcept {
|
||||
out = in;
|
||||
int64_t i = 0;
|
||||
char nonBreakingSpaces = 0xa0;
|
||||
|
||||
// loop through all the chars
|
||||
while (i < out.size()) {
|
||||
// remove whitespaces and non breaking spaces (NBSP)
|
||||
if (isspace(out[i]) || (out[i] == NBSP)) {
|
||||
if (isspace(out[i]) || (out[i] == nonBreakingSpaces)) {
|
||||
out.erase(i, 1);
|
||||
} else {
|
||||
/* if the space is not a whitespace char, increment counter
|
||||
|
||||
@@ -29,14 +29,22 @@ namespace transformations {
|
||||
|
||||
|
||||
void Trim::ltrim(ModSecString *s) {
|
||||
s->erase(s->begin(), std::find_if(s->begin(), s->end(),
|
||||
std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||
s->erase(
|
||||
s->begin(),
|
||||
std::find_if(s->begin(), s->end(), [](unsigned char c) {
|
||||
return !std::isspace(c);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Trim::rtrim(ModSecString *s) {
|
||||
s->erase(std::find_if(s->rbegin(), s->rend(),
|
||||
std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s->end());
|
||||
s->erase(
|
||||
std::find_if(s->rbegin(), s->rend(), [](unsigned char c) {
|
||||
return !std::isspace(c);
|
||||
}).base(),
|
||||
s->end()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1325,14 +1325,13 @@ int Transaction::appendResponseBody(const unsigned char *buf, size_t len) {
|
||||
* contents of the response body, otherwise there is no need to call this
|
||||
* method.
|
||||
*
|
||||
* WARN: This is a skeleton that it is not in use yet.
|
||||
*
|
||||
* @return It returns a buffer (const char *)
|
||||
* @retval >0 body was update and available.
|
||||
* @retval NULL Nothing was updated.
|
||||
*
|
||||
*/
|
||||
const char *Transaction::getResponseBody() const {
|
||||
// int there_is_update = this->rules->loadResponseBodyFromJS(this);
|
||||
return this->m_responseBody.str().c_str();
|
||||
return strdup(this->m_responseBody.str().c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree
|
||||
unsigned char *buffer = NULL;
|
||||
unsigned char bitlen = 0;
|
||||
int bit_validation = 0, test_bit = 0;
|
||||
int i = 0;
|
||||
size_t i = 0;
|
||||
unsigned int x, y;
|
||||
TreeNode *node = NULL, *new_node = NULL;
|
||||
TreeNode *parent = NULL, *i_node = NULL;
|
||||
|
||||
Reference in New Issue
Block a user