Fix some issues reported by the static analysis

This commit is contained in:
Felipe Zimmerle 2016-03-18 18:52:48 -03:00
parent 28008be616
commit c43391072c
5 changed files with 34 additions and 34 deletions

View File

@ -90,34 +90,35 @@ class Rule {
class RuleMessage {
public:
RuleMessage(Rule *rule) {
m_ruleFile = rule->m_fileName;
m_ruleLine = rule->m_lineNumber;
m_ruleId = rule->rule_id;
m_rev = rule->m_rev;
m_accuracy = rule->m_accuracy;
m_message = std::string("");
m_data = std::string("");
m_severity = 0;
m_ver = rule->m_ver;
m_maturity = rule->m_maturity;
m_rule = rule;
m_match = std::string("");
};
RuleMessage(Rule *rule, std::string message) {
m_ruleFile = rule->m_fileName;
m_ruleLine = rule->m_lineNumber;
m_ruleId = rule->rule_id;
m_rev = rule->m_rev;
m_accuracy = rule->m_accuracy;
m_message = message;
m_data = std::string("");
m_severity = 0;
m_ver = rule->m_ver;
m_maturity = rule->m_maturity;
m_rule = rule;
m_match = std::string("");
};
RuleMessage(Rule *rule) :
m_ruleFile(rule->m_fileName),
m_ruleLine(rule->m_lineNumber),
m_ruleId(rule->rule_id),
m_rev(rule->m_rev),
m_accuracy(rule->m_accuracy),
m_message(std::string("")),
m_data(std::string("")),
m_severity(0),
m_ver(rule->m_ver),
m_maturity(rule->m_maturity),
m_rule(rule),
m_match(std::string(""))
{ }
RuleMessage(Rule *rule, std::string message) :
m_ruleFile(rule->m_fileName),
m_ruleLine(rule->m_lineNumber),
m_ruleId(rule->rule_id),
m_rev(rule->m_rev),
m_accuracy(rule->m_accuracy),
m_message(message),
m_data(std::string("")),
m_severity(0),
m_ver(rule->m_ver),
m_maturity(rule->m_maturity),
m_rule(rule),
m_match(std::string(""))
{ }
std::string m_match;
std::string m_ruleFile;

View File

@ -53,6 +53,8 @@ bool InitCol::init(std::string *error) {
bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
std::string collectionName;
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;
}

View File

@ -114,7 +114,7 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, std::string ipStr,
debug(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \
+ std::to_string(days) + " " \
"days since last activity, threat score " \
+ std::to_string(score));
+ std::to_string(score) + ". Case: " + ptype);
}

View File

@ -125,7 +125,6 @@ void chomp(std::string *str) {
std::string tolower(std::string str) {
std::locale loc;
std::string value;
value.resize(str.length());

View File

@ -116,15 +116,13 @@ using namespace modsecurity;
int main(int argc, char** argv) {
size_t count;
uint8_t buf[128];
ssize_t read_bytes;
uint8_t buf[128];
std::string lastString;
while (__AFL_LOOP(1000)) {
ssize_t read_bytes;
// (re-) initialize the library and read new input
read_bytes = -1;
memset(buf, 0, 128);
read_bytes = read(STDIN_FILENO, buf, 128);