mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Cosmetic: pleasing cppcheck
This commit is contained in:
parent
6fdba42c02
commit
7fccb0d225
@ -25,7 +25,6 @@
|
|||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "src/actions/transformations/transformation.h"
|
#include "src/actions/transformations/transformation.h"
|
||||||
|
|
||||||
#define NBSP 160 // non breaking space char
|
|
||||||
|
|
||||||
namespace modsecurity {
|
namespace modsecurity {
|
||||||
namespace actions {
|
namespace actions {
|
||||||
@ -41,12 +40,15 @@ std::string RemoveWhitespace::evaluate(const std::string &val,
|
|||||||
std::string value(val);
|
std::string value(val);
|
||||||
|
|
||||||
int64_t i = 0;
|
int64_t i = 0;
|
||||||
char nonBreakingSpaces = 0xa0;
|
const char nonBreakingSpaces = 0xa0;
|
||||||
|
const char nonBreakingSpaces2 = 0xc2;
|
||||||
|
|
||||||
// loop through all the chars
|
// loop through all the chars
|
||||||
while (i < value.size()) {
|
while (i < value.size()) {
|
||||||
// remove whitespaces and non breaking spaces (NBSP)
|
// remove whitespaces and non breaking spaces (NBSP)
|
||||||
if (isspace(value[i]) || (value[i] == nonBreakingSpaces)) {
|
if (std::isspace(static_cast<unsigned char>(value[i]))
|
||||||
|
|| (value[i] == nonBreakingSpaces)
|
||||||
|
|| value[i] == nonBreakingSpaces2) {
|
||||||
value.erase(i, 1);
|
value.erase(i, 1);
|
||||||
} else {
|
} else {
|
||||||
/* if the space is not a whitespace char, increment counter
|
/* if the space is not a whitespace char, increment counter
|
||||||
|
@ -53,7 +53,7 @@ bool Https::write(Transaction *transaction, int parts, std::string *error) {
|
|||||||
|
|
||||||
std::string log = transaction->toJSON(parts);
|
std::string log = transaction->toJSON(parts);
|
||||||
m_http_client.setRequestType("application/json");
|
m_http_client.setRequestType("application/json");
|
||||||
m_http_client.setRequestBody(log.c_str());
|
m_http_client.setRequestBody(log);
|
||||||
m_http_client.download(m_audit->m_path1);
|
m_http_client.download(m_audit->m_path1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user