mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
Coding style fixes
This commit is contained in:
@@ -56,7 +56,8 @@ bool FuzzyHash::init(const std::string ¶m2, std::string *error) {
|
||||
}
|
||||
|
||||
for (std::string line; std::getline(*iss, line); ) {
|
||||
chunk = (struct fuzzy_hash_chunk *)calloc(1, sizeof(struct fuzzy_hash_chunk));
|
||||
chunk = (struct fuzzy_hash_chunk *)calloc(1,
|
||||
sizeof(struct fuzzy_hash_chunk));
|
||||
|
||||
chunk->data = strdup(line.c_str());
|
||||
chunk->next = NULL;
|
||||
@@ -77,7 +78,8 @@ bool FuzzyHash::init(const std::string ¶m2, std::string *error) {
|
||||
delete iss;
|
||||
return true;
|
||||
#else
|
||||
error->assign("@fuzzyHash: SSDEEP support was not enabled during the compilation.");
|
||||
error->assign("@fuzzyHash: SSDEEP support was not enabled " \
|
||||
"during the compilation.");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@@ -89,17 +91,15 @@ bool FuzzyHash::evaluate(Transaction *t, const std::string &str) {
|
||||
char result[FUZZY_MAX_RESULT];
|
||||
struct fuzzy_hash_chunk *chunk = m_head;
|
||||
|
||||
if (fuzzy_hash_buf((const unsigned char*)str.c_str(), str.size(), result))
|
||||
{
|
||||
if (fuzzy_hash_buf((const unsigned char*)str.c_str(),
|
||||
str.size(), result)) {
|
||||
t->debug(4, "Problems generating fuzzy hash");
|
||||
return false;
|
||||
}
|
||||
|
||||
while (chunk != NULL)
|
||||
{
|
||||
while (chunk != NULL) {
|
||||
int i = fuzzy_compare(chunk->data, result);
|
||||
if (i >= m_threshold)
|
||||
{
|
||||
if (i >= m_threshold) {
|
||||
t->debug(4, "Fuzzy hash: matched " \
|
||||
"with score: " + std::to_string(i) + ".");
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user