mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Cosmetics: Fix coding style
This commit is contained in:
parent
3615c84ee5
commit
4cf6c714ac
@ -39,7 +39,7 @@ namespace collection {
|
||||
|
||||
class Collection {
|
||||
public:
|
||||
virtual ~Collection() { };
|
||||
virtual ~Collection() { }
|
||||
virtual void store(std::string key, std::string value) = 0;
|
||||
|
||||
virtual bool storeOrUpdateFirst(const std::string &key,
|
||||
|
@ -103,7 +103,7 @@ class RulesProperties {
|
||||
*/
|
||||
~RulesProperties() {
|
||||
delete m_debugLog;
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Rule *> rules[7];
|
||||
std::vector<Rule *> * getRulesForPhase(int phase) {
|
||||
|
@ -73,7 +73,7 @@ class Rules;
|
||||
class RuleMessage;
|
||||
namespace actions {
|
||||
class Action;
|
||||
enum AllowType : short;
|
||||
enum AllowType : int;
|
||||
}
|
||||
namespace RequestBodyProcessor {
|
||||
class XML;
|
||||
|
@ -124,8 +124,6 @@ class Action {
|
||||
*/
|
||||
RunTimeOnlyIfMatchKind,
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -36,7 +36,8 @@ bool Allow::init(std::string *error) {
|
||||
} else if (a == "") {
|
||||
m_allowType = FromNowOneAllowType;
|
||||
} else {
|
||||
error->assign("Allow: if specified, the parameter most be: phase, request");
|
||||
error->assign("Allow: if specified, the parameter " \
|
||||
"most be: phase, request");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Rule;
|
||||
|
||||
namespace actions {
|
||||
|
||||
enum AllowType : short {
|
||||
enum AllowType : int {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -61,7 +61,7 @@ class Allow : public Action {
|
||||
|
||||
AllowType m_allowType;
|
||||
|
||||
static std::string allowTypeToName (AllowType a) {
|
||||
static std::string allowTypeToName(AllowType a) {
|
||||
if (a == NoneAllowType) {
|
||||
return "None";
|
||||
} else if (a == RequestAllowType) {
|
||||
|
@ -36,7 +36,8 @@ bool InitCol::init(std::string *error) {
|
||||
return false;
|
||||
}
|
||||
if (posEquals == std::string::npos) {
|
||||
error->assign("Something wrong with initcol format: missing equals sign");
|
||||
error->assign("Something wrong with initcol format: missing " \
|
||||
"equals sign");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -46,7 +47,8 @@ bool InitCol::init(std::string *error) {
|
||||
if (m_collection_key != "ip" &&
|
||||
m_collection_key != "global" &&
|
||||
m_collection_key != "resource") {
|
||||
error->assign("Something wrong with initcol: collection must be `ip' or `global'");
|
||||
error->assign("Something wrong with initcol: collection must be " \
|
||||
"`ip' or `global'");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace transformations {
|
||||
|
||||
class Base64Decode : public Transformation {
|
||||
public:
|
||||
explicit Base64Decode(std::string action) : Transformation(action) { };
|
||||
explicit Base64Decode(std::string action) : Transformation(action) { }
|
||||
|
||||
std::string evaluate(std::string exp,
|
||||
Transaction *transaction) override;
|
||||
|
@ -30,7 +30,7 @@ namespace transformations {
|
||||
|
||||
class Base64Encode : public Transformation {
|
||||
public:
|
||||
explicit Base64Encode(std::string action) : Transformation(action) { };
|
||||
explicit Base64Encode(std::string action) : Transformation(action) { }
|
||||
|
||||
std::string evaluate(std::string exp,
|
||||
Transaction *transaction) override;
|
||||
|
@ -43,7 +43,6 @@ std::string CmdLine::evaluate(std::string value,
|
||||
case '\'':
|
||||
case '\\':
|
||||
case '^':
|
||||
//ret.append("i was here");
|
||||
break;
|
||||
|
||||
/* replace some characters to space (only one) */
|
||||
@ -85,3 +84,4 @@ std::string CmdLine::evaluate(std::string value,
|
||||
} // namespace transformations
|
||||
} // namespace actions
|
||||
} // namespace modsecurity
|
||||
|
||||
|
@ -44,3 +44,4 @@ class CmdLine : public Transformation {
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_CMD_LINE_H_
|
||||
|
||||
|
@ -54,12 +54,13 @@ std::string RemoveCommentsChar::evaluate(std::string value,
|
||||
&& value.at(i+2) == '-'
|
||||
&& (i+3 < value.size())
|
||||
&& value.at(i+3) == '-') {
|
||||
|
||||
value.erase(i, 4);
|
||||
} else if (value.at(i) == '-' && (i+1 < value.size()) && value.at(i+1) == '-' &&
|
||||
(i+2 < value.size()) && value.at(i+2) == '>') {
|
||||
} else if (value.at(i) == '-'
|
||||
&& (i+1 < value.size()) && value.at(i+1) == '-'
|
||||
&& (i+2 < value.size()) && value.at(i+2) == '>') {
|
||||
value.erase(i, 3);
|
||||
} else if (value.at(i) == '-' && (i+1 < value.size()) && value.at(i+1) == '-') {
|
||||
} else if (value.at(i) == '-'
|
||||
&& (i+1 < value.size()) && value.at(i+1) == '-') {
|
||||
value.erase(i, 2);
|
||||
} else if (value.at(i) == '#') {
|
||||
value.erase(i, 1);
|
||||
@ -73,3 +74,4 @@ std::string RemoveCommentsChar::evaluate(std::string value,
|
||||
} // namespace transformations
|
||||
} // namespace actions
|
||||
} // namespace modsecurity
|
||||
|
||||
|
@ -53,7 +53,6 @@ class Https : public audit_log::Writer {
|
||||
|
||||
bool init() override;
|
||||
bool write(Transaction *transaction, int parts) override;
|
||||
|
||||
};
|
||||
|
||||
} // namespace writer
|
||||
|
@ -117,7 +117,8 @@ void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
|
||||
return;
|
||||
}
|
||||
std::string col = std::string(var, 0, var.find(":"));
|
||||
std::string name = std::string(var, var.find(":") + 2, var.size() - var.find(":") - 3);
|
||||
std::string name = std::string(var, var.find(":") + 2,
|
||||
var.size() - var.find(":") - 3);
|
||||
size_t keySize = col.size();
|
||||
Utils::Regex r = Utils::Regex(name);
|
||||
|
||||
|
@ -35,7 +35,8 @@ namespace backend {
|
||||
|
||||
LMDB::LMDB() : m_env(NULL) {
|
||||
mdb_env_create(&m_env);
|
||||
mdb_env_open(m_env, "./modsec-shared-collections", MDB_WRITEMAP | MDB_NOSUBDIR, 0664);
|
||||
mdb_env_open(m_env, "./modsec-shared-collections",
|
||||
MDB_WRITEMAP | MDB_NOSUBDIR, 0664);
|
||||
}
|
||||
|
||||
|
||||
@ -46,9 +47,10 @@ LMDB::~LMDB() {
|
||||
|
||||
void LMDB::string2val(const std::string& str, MDB_val *val) {
|
||||
val->mv_size = sizeof(char)*(str.size());
|
||||
val->mv_data = (char *)str.c_str();
|
||||
val->mv_data = const_cast<char *>(str.c_str());
|
||||
}
|
||||
|
||||
|
||||
void LMDB::lmdb_debug(int rc, std::string op, std::string scope) {
|
||||
#ifndef LMDB_STDOUT_COUT
|
||||
return;
|
||||
|
@ -49,6 +49,7 @@ class Operator {
|
||||
|
||||
virtual bool evaluate(Transaction *transaction, const std::string &str);
|
||||
static Operator *instantiate(std::string op);
|
||||
|
||||
protected:
|
||||
bool debug(Transaction *transaction, int x, std::string a);
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ bool PmFromFile::init(const std::string &config, std::string *error) {
|
||||
acmp_add_pattern(m_p, line.c_str(), NULL, NULL, line.length());
|
||||
}
|
||||
|
||||
//acmp_prepare(m_p);
|
||||
// acmp_prepare(m_p);
|
||||
|
||||
delete iss;
|
||||
return true;
|
||||
|
@ -102,7 +102,6 @@ Multipart::~Multipart() {
|
||||
delete m_mpp;
|
||||
m_mpp = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -627,7 +626,8 @@ int Multipart::process_part_header(std::string *error) {
|
||||
|
||||
if (m_mpp->m_headers.count("Content-Disposition") == 0) {
|
||||
debug(1, "Multipart: Part missing Content-Disposition header.");
|
||||
error->assign("Multipart: Part missing Content-Disposition header.");
|
||||
error->assign("Multipart: Part missing " \
|
||||
"Content-Disposition header.");
|
||||
return false;
|
||||
}
|
||||
header_value = m_mpp->m_headers.at("Content-Disposition");
|
||||
@ -737,8 +737,8 @@ int Multipart::process_part_header(std::string *error) {
|
||||
if (*data == '\0') {
|
||||
debug(1, "Multipart: Invalid part header (colon missing): " \
|
||||
+ std::string(m_buf));
|
||||
error->assign("Multipart: Invalid part header (colon missing): " \
|
||||
+ std::string(m_buf));
|
||||
error->assign("Multipart: Invalid part header " \
|
||||
"(colon missing): " + std::string(m_buf));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class MultipartPart {
|
||||
m_offset(0),
|
||||
m_length(0) { }
|
||||
|
||||
~MultipartPart () {
|
||||
~MultipartPart() {
|
||||
m_headers.clear();
|
||||
m_value_parts.clear();
|
||||
}
|
||||
|
@ -268,21 +268,24 @@ bool Transaction::extractArguments(const std::string &orig,
|
||||
|
||||
key_s = (key.length() + 1);
|
||||
value_s = (value.length() + 1);
|
||||
unsigned char *key_c = (unsigned char *) calloc(sizeof(char), key_s);
|
||||
unsigned char *value_c = (unsigned char *) calloc(sizeof(char), value_s);
|
||||
unsigned char *key_c = reinterpret_cast<unsigned char *>(
|
||||
calloc(sizeof(char), key_s));
|
||||
unsigned char *value_c = reinterpret_cast<unsigned char *>(
|
||||
calloc(sizeof(char), value_s));
|
||||
|
||||
memcpy(key_c, key.c_str(), key_s);
|
||||
memcpy(value_c, value.c_str(), value_s);
|
||||
|
||||
key_s = urldecode_nonstrict_inplace(key_c, key_s, &invalid, &changed);
|
||||
value_s = urldecode_nonstrict_inplace(value_c, value_s, &invalid, &changed);
|
||||
value_s = urldecode_nonstrict_inplace(value_c, value_s,
|
||||
&invalid, &changed);
|
||||
|
||||
if (invalid) {
|
||||
m_collections.storeOrUpdateFirst("URLENCODED_ERROR", "1");
|
||||
}
|
||||
|
||||
addArgument(orig, std::string((char *)key_c, key_s-1),
|
||||
std::string((char *)value_c, value_s-1));
|
||||
addArgument(orig, std::string(reinterpret_cast<char *>(key_c), key_s-1),
|
||||
std::string(reinterpret_cast<char *>(value_c), value_s-1));
|
||||
|
||||
free(key_c);
|
||||
free(value_c);
|
||||
|
@ -134,7 +134,7 @@ int urldecode_nonstrict_inplace(unsigned char *input,
|
||||
|
||||
|
||||
std::string removeBracketsIfNeeded(std::string a) {
|
||||
if ((a.at(0) == '"') and (a.at(a.length()-1) == '"')) {
|
||||
if ((a.at(0) == '"') && (a.at(a.length()-1) == '"')) {
|
||||
a.pop_back();
|
||||
a.erase(0, 1);
|
||||
}
|
||||
|
@ -13,19 +13,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/base64.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "utils/base64.h"
|
||||
#include "mbedtls/base64.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace modsecurity {
|
||||
namespace Utils {
|
||||
|
||||
|
||||
std::string Base64::encode(std::string& data) {
|
||||
std::string Base64::encode(const std::string& data) {
|
||||
size_t encoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
std::string ret;
|
||||
@ -51,7 +53,7 @@ std::string Base64::encode(std::string& data) {
|
||||
}
|
||||
|
||||
|
||||
std::string Base64::decode(std::string& data, bool forgiven) {
|
||||
std::string Base64::decode(const std::string& data, bool forgiven) {
|
||||
if (forgiven) {
|
||||
return decode_forgiven(data);
|
||||
}
|
||||
@ -60,7 +62,7 @@ std::string Base64::decode(std::string& data, bool forgiven) {
|
||||
}
|
||||
|
||||
|
||||
std::string Base64::decode(std::string& data) {
|
||||
std::string Base64::decode(const std::string& data) {
|
||||
size_t decoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
std::string ret;
|
||||
@ -86,7 +88,7 @@ std::string Base64::decode(std::string& data) {
|
||||
}
|
||||
|
||||
|
||||
std::string Base64::decode_forgiven(std::string& data) {
|
||||
std::string Base64::decode_forgiven(const std::string& data) {
|
||||
size_t decoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
std::string ret;
|
||||
@ -117,7 +119,7 @@ void Base64::decode_forgiven_engine(unsigned char *plain_text,
|
||||
int i = 0, j = 0, k = 0;
|
||||
int ch = 0;
|
||||
static const char b64_pad = '=';
|
||||
static short b64_reverse_t[256] = {
|
||||
static int b64_reverse_t[256] = {
|
||||
-2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -2, -2, -1, -2, -2,
|
||||
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
|
||||
-1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, -2, -2, 63,
|
||||
@ -154,7 +156,7 @@ void Base64::decode_forgiven_engine(unsigned char *plain_text,
|
||||
*aiming_size = 0;
|
||||
return;
|
||||
}
|
||||
switch(i % 4) {
|
||||
switch (i % 4) {
|
||||
case 0:
|
||||
if (plain_text_size != 0) {
|
||||
plain_text[j] = ch << 2;
|
||||
@ -189,7 +191,7 @@ void Base64::decode_forgiven_engine(unsigned char *plain_text,
|
||||
k = j;
|
||||
|
||||
if (ch == b64_pad) {
|
||||
switch(i % 4) {
|
||||
switch (i % 4) {
|
||||
case 1:
|
||||
*aiming_size = 0;
|
||||
return;
|
||||
|
@ -1,5 +1,24 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SRC_UTILS_BASE64_H_
|
||||
#define SRC_UTILS_BASE64_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace modsecurity {
|
||||
namespace Utils {
|
||||
|
||||
@ -7,18 +26,20 @@ class Base64 {
|
||||
public:
|
||||
Base64() { }
|
||||
|
||||
static std::string encode(std::string& data);
|
||||
static std::string encode(const std::string& data);
|
||||
|
||||
static std::string decode(std::string& data, bool forgiven);
|
||||
static std::string decode(std::string& data);
|
||||
static std::string decode_forgiven(std::string& data);
|
||||
static std::string decode(const std::string& data, bool forgiven);
|
||||
static std::string decode(const std::string& data);
|
||||
static std::string decode_forgiven(const std::string& data);
|
||||
|
||||
static void decode_forgiven_engine(unsigned char *output,
|
||||
size_t output_size, size_t *aiming_size, const unsigned char *input,
|
||||
size_t input_size);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace modsecurity
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_UTILS_BASE64_H_
|
||||
|
||||
|
@ -43,7 +43,7 @@ class SMatch {
|
||||
public:
|
||||
SMatch() : size_(0) { }
|
||||
size_t size() const { return size_; }
|
||||
std::string str() const { return match; }
|
||||
std::string str() const { return match; }
|
||||
int size_;
|
||||
std::string match;
|
||||
};
|
||||
|
@ -21,15 +21,15 @@ namespace modsecurity {
|
||||
namespace Utils {
|
||||
|
||||
|
||||
std::string Sha1::hexdigest(std::string& input) {
|
||||
std::string Sha1::hexdigest(const std::string& input) {
|
||||
unsigned char digest[20];
|
||||
|
||||
mbedtls_sha1(reinterpret_cast<const unsigned char *>(input.c_str()),
|
||||
input.size(), digest);
|
||||
|
||||
char buf[41];
|
||||
for (int i=0; i<20; i++) {
|
||||
sprintf(buf+i*2, "%02x", digest[i]);
|
||||
for (int i=0; i < 20; i++) {
|
||||
snprintf(buf+i*2, sizeof(char)*2, "%02x", digest[i]);
|
||||
}
|
||||
buf[40] = 0;
|
||||
|
||||
@ -37,7 +37,7 @@ std::string Sha1::hexdigest(std::string& input) {
|
||||
}
|
||||
|
||||
|
||||
std::string Sha1::digest(std::string& input) {
|
||||
std::string Sha1::digest(const std::string& input) {
|
||||
unsigned char output[20];
|
||||
std::string ret;
|
||||
|
||||
|
@ -28,8 +28,8 @@ class Sha1 {
|
||||
public:
|
||||
Sha1() { }
|
||||
|
||||
static std::string hexdigest(std::string& input);
|
||||
static std::string digest(std::string& input);
|
||||
static std::string hexdigest(const std::string& input);
|
||||
static std::string digest(const std::string& input);
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
@ -43,4 +43,5 @@ class RemoteUser : public Variable {
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_REMOTE_USER_H_
|
||||
#endif // SRC_VARIABLES_REMOTE_USER_H_
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <map>
|
||||
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
@ -54,7 +55,7 @@ void Rule::evaluateInternal(Transaction *t,
|
||||
|
||||
// id
|
||||
envs.insert(std::pair<std::string, std::string>("RULE:id",
|
||||
std::to_string(rule->rule_id)));
|
||||
std::to_string(rule->rule_id)));
|
||||
|
||||
// rev
|
||||
envs.insert(std::pair<std::string, std::string>("RULE:rev",
|
||||
|
@ -30,7 +30,7 @@ namespace Variables {
|
||||
class Rule : public Variable {
|
||||
public:
|
||||
explicit Rule(std::string _name)
|
||||
: Variable(_name) { };
|
||||
: Variable(_name) { }
|
||||
|
||||
void evaluateInternal(Transaction *transaction,
|
||||
modsecurity::Rule *rule,
|
||||
|
@ -37,7 +37,8 @@ Variable::Variable(std::string name)
|
||||
m_isCount(false) {
|
||||
if (m_name.find(":") != std::string::npos) {
|
||||
std::string col = toupper(std::string(m_name, 0, m_name.find(":")));
|
||||
std::string name = std::string(m_name, m_name.find(":") + 1, m_name.size());
|
||||
std::string name = std::string(m_name, m_name.find(":") + 1,
|
||||
m_name.size());
|
||||
if (col == "TX" || col == "IP" || col == "GLOBAL"
|
||||
|| col == "RESOURCE" || col == "SESSION") {
|
||||
m_collectionName = col;
|
||||
@ -83,7 +84,8 @@ Variable::Variable(std::string name, VariableKind kind)
|
||||
m_isCount(false) {
|
||||
if (m_name.find(":") != std::string::npos) {
|
||||
std::string col = toupper(std::string(m_name, 0, m_name.find(":")));
|
||||
std::string name = std::string(m_name, m_name.find(":") + 1, m_name.size());
|
||||
std::string name = std::string(m_name, m_name.find(":") + 1,
|
||||
m_name.size());
|
||||
if (col == "TX" || col == "IP" || col == "GLOBAL"
|
||||
|| col == "RESOURCE" || col == "SESSION") {
|
||||
m_collectionName = col;
|
||||
|
@ -142,7 +142,7 @@ void ModSecurityTest<T>::cmd_options(int argc, char **argv) {
|
||||
m_automake_output = true;
|
||||
}
|
||||
|
||||
if(const char* env_p = std::getenv("AUTOMAKE_TESTS")) {
|
||||
if (const char* env_p = std::getenv("AUTOMAKE_TESTS")) {
|
||||
m_automake_output = true;
|
||||
}
|
||||
|
||||
|
@ -270,9 +270,11 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
|
||||
|
||||
modsec_transaction->processRequestHeaders();
|
||||
actions(&r, modsec_transaction);
|
||||
#if 0
|
||||
if (r.status != 200) {
|
||||
//goto end;
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
modsec_transaction->appendRequestBody(
|
||||
(unsigned char *)t->request_body.c_str(),
|
||||
@ -291,7 +293,8 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
|
||||
headers.second.c_str());
|
||||
}
|
||||
|
||||
modsec_transaction->processResponseHeaders(r.status, t->response_protocol);
|
||||
modsec_transaction->processResponseHeaders(r.status,
|
||||
t->response_protocol);
|
||||
actions(&r, modsec_transaction);
|
||||
#if 0
|
||||
if (r.status != 200) {
|
||||
|
@ -91,7 +91,6 @@ void perform_unit_test(ModSecurityTest<UnitTest> *test, UnitTest *t,
|
||||
std::cout << t->name << " "
|
||||
<< modsecurity::toHexIfNeeded(t->input) << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -150,9 +149,9 @@ int main(int argc, char **argv) {
|
||||
if (results.size() == 0) {
|
||||
std::cout << KGRN << "All tests passed" << RESET << std::endl;
|
||||
} else {
|
||||
std::cout << KRED << results.size() << " failed." << RESET << std::endl;
|
||||
std::cout << KRED << results.size() << " failed.";
|
||||
std::cout << RESET << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (std::pair<std::string, std::vector<UnitTest *> *> a : test) {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#include "common/colors.h"
|
||||
#include "src/utils.h"
|
||||
@ -62,7 +61,8 @@ void json2bin(std::string *str) {
|
||||
modsecurity::Utils::Regex re2("\\\\u([a-z0-9A-Z]{4})");
|
||||
modsecurity::Utils::SMatch match;
|
||||
|
||||
while (modsecurity::Utils::regex_search(*str, &match, re) && match.size() > 0) {
|
||||
while (modsecurity::Utils::regex_search(*str, &match, re)
|
||||
&& match.size() > 0) {
|
||||
unsigned int p;
|
||||
std::string toBeReplaced = match.str();
|
||||
toBeReplaced.erase(0, 2);
|
||||
@ -70,7 +70,8 @@ void json2bin(std::string *str) {
|
||||
replaceAll(str, match.str(), p);
|
||||
}
|
||||
|
||||
while (modsecurity::Utils::regex_search(*str, &match, re2) && match.size() > 0) {
|
||||
while (modsecurity::Utils::regex_search(*str, &match, re2)
|
||||
&& match.size() > 0) {
|
||||
unsigned int p;
|
||||
std::string toBeReplaced = match.str();
|
||||
toBeReplaced.erase(0, 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user