mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix some issues reported by the static analysis
This commit is contained in:
parent
28008be616
commit
c43391072c
@ -90,34 +90,35 @@ class Rule {
|
|||||||
|
|
||||||
class RuleMessage {
|
class RuleMessage {
|
||||||
public:
|
public:
|
||||||
RuleMessage(Rule *rule) {
|
RuleMessage(Rule *rule) :
|
||||||
m_ruleFile = rule->m_fileName;
|
m_ruleFile(rule->m_fileName),
|
||||||
m_ruleLine = rule->m_lineNumber;
|
m_ruleLine(rule->m_lineNumber),
|
||||||
m_ruleId = rule->rule_id;
|
m_ruleId(rule->rule_id),
|
||||||
m_rev = rule->m_rev;
|
m_rev(rule->m_rev),
|
||||||
m_accuracy = rule->m_accuracy;
|
m_accuracy(rule->m_accuracy),
|
||||||
m_message = std::string("");
|
m_message(std::string("")),
|
||||||
m_data = std::string("");
|
m_data(std::string("")),
|
||||||
m_severity = 0;
|
m_severity(0),
|
||||||
m_ver = rule->m_ver;
|
m_ver(rule->m_ver),
|
||||||
m_maturity = rule->m_maturity;
|
m_maturity(rule->m_maturity),
|
||||||
m_rule = rule;
|
m_rule(rule),
|
||||||
m_match = std::string("");
|
m_match(std::string(""))
|
||||||
};
|
{ }
|
||||||
RuleMessage(Rule *rule, std::string message) {
|
|
||||||
m_ruleFile = rule->m_fileName;
|
RuleMessage(Rule *rule, std::string message) :
|
||||||
m_ruleLine = rule->m_lineNumber;
|
m_ruleFile(rule->m_fileName),
|
||||||
m_ruleId = rule->rule_id;
|
m_ruleLine(rule->m_lineNumber),
|
||||||
m_rev = rule->m_rev;
|
m_ruleId(rule->rule_id),
|
||||||
m_accuracy = rule->m_accuracy;
|
m_rev(rule->m_rev),
|
||||||
m_message = message;
|
m_accuracy(rule->m_accuracy),
|
||||||
m_data = std::string("");
|
m_message(message),
|
||||||
m_severity = 0;
|
m_data(std::string("")),
|
||||||
m_ver = rule->m_ver;
|
m_severity(0),
|
||||||
m_maturity = rule->m_maturity;
|
m_ver(rule->m_ver),
|
||||||
m_rule = rule;
|
m_maturity(rule->m_maturity),
|
||||||
m_match = std::string("");
|
m_rule(rule),
|
||||||
};
|
m_match(std::string(""))
|
||||||
|
{ }
|
||||||
|
|
||||||
std::string m_match;
|
std::string m_match;
|
||||||
std::string m_ruleFile;
|
std::string m_ruleFile;
|
||||||
|
@ -53,6 +53,8 @@ bool InitCol::init(std::string *error) {
|
|||||||
bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
|
bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
|
||||||
std::string collectionName;
|
std::string collectionName;
|
||||||
collectionName = MacroExpansion::expand(m_collection_value, transaction);
|
collectionName = MacroExpansion::expand(m_collection_value, transaction);
|
||||||
|
std::cout << "Collection is not implemented yet, here is the ";
|
||||||
|
std::cout << "collection name: " << collectionName << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, std::string ipStr,
|
|||||||
debug(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \
|
debug(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \
|
||||||
+ std::to_string(days) + " " \
|
+ std::to_string(days) + " " \
|
||||||
"days since last activity, threat score " \
|
"days since last activity, threat score " \
|
||||||
+ std::to_string(score));
|
+ std::to_string(score) + ". Case: " + ptype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,6 @@ void chomp(std::string *str) {
|
|||||||
|
|
||||||
|
|
||||||
std::string tolower(std::string str) {
|
std::string tolower(std::string str) {
|
||||||
std::locale loc;
|
|
||||||
std::string value;
|
std::string value;
|
||||||
value.resize(str.length());
|
value.resize(str.length());
|
||||||
|
|
||||||
|
@ -116,15 +116,13 @@ using namespace modsecurity;
|
|||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
size_t count;
|
uint8_t buf[128];
|
||||||
uint8_t buf[128];
|
|
||||||
ssize_t read_bytes;
|
|
||||||
|
|
||||||
std::string lastString;
|
std::string lastString;
|
||||||
|
|
||||||
while (__AFL_LOOP(1000)) {
|
while (__AFL_LOOP(1000)) {
|
||||||
|
ssize_t read_bytes;
|
||||||
// (re-) initialize the library and read new input
|
// (re-) initialize the library and read new input
|
||||||
read_bytes = -1;
|
|
||||||
memset(buf, 0, 128);
|
memset(buf, 0, 128);
|
||||||
read_bytes = read(STDIN_FILENO, buf, 128);
|
read_bytes = read(STDIN_FILENO, buf, 128);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user