Skip to content

Commit c433910

Browse files
committed
Fix some issues reported by the static analysis
1 parent 28008be commit c433910

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

headers/modsecurity/rule.h

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -90,34 +90,35 @@ class Rule {
9090

9191
class RuleMessage {
9292
public:
93-
RuleMessage(Rule *rule) {
94-
m_ruleFile = rule->m_fileName;
95-
m_ruleLine = rule->m_lineNumber;
96-
m_ruleId = rule->rule_id;
97-
m_rev = rule->m_rev;
98-
m_accuracy = rule->m_accuracy;
99-
m_message = std::string("");
100-
m_data = std::string("");
101-
m_severity = 0;
102-
m_ver = rule->m_ver;
103-
m_maturity = rule->m_maturity;
104-
m_rule = rule;
105-
m_match = std::string("");
106-
};
107-
RuleMessage(Rule *rule, std::string message) {
108-
m_ruleFile = rule->m_fileName;
109-
m_ruleLine = rule->m_lineNumber;
110-
m_ruleId = rule->rule_id;
111-
m_rev = rule->m_rev;
112-
m_accuracy = rule->m_accuracy;
113-
m_message = message;
114-
m_data = std::string("");
115-
m_severity = 0;
116-
m_ver = rule->m_ver;
117-
m_maturity = rule->m_maturity;
118-
m_rule = rule;
119-
m_match = std::string("");
120-
};
93+
RuleMessage(Rule *rule) :
94+
m_ruleFile(rule->m_fileName),
95+
m_ruleLine(rule->m_lineNumber),
96+
m_ruleId(rule->rule_id),
97+
m_rev(rule->m_rev),
98+
m_accuracy(rule->m_accuracy),
99+
m_message(std::string("")),
100+
m_data(std::string("")),
101+
m_severity(0),
102+
m_ver(rule->m_ver),
103+
m_maturity(rule->m_maturity),
104+
m_rule(rule),
105+
m_match(std::string(""))
106+
{ }
107+
108+
RuleMessage(Rule *rule, std::string message) :
109+
m_ruleFile(rule->m_fileName),
110+
m_ruleLine(rule->m_lineNumber),
111+
m_ruleId(rule->rule_id),
112+
m_rev(rule->m_rev),
113+
m_accuracy(rule->m_accuracy),
114+
m_message(message),
115+
m_data(std::string("")),
116+
m_severity(0),
117+
m_ver(rule->m_ver),
118+
m_maturity(rule->m_maturity),
119+
m_rule(rule),
120+
m_match(std::string(""))
121+
{ }
121122

122123
std::string m_match;
123124
std::string m_ruleFile;

src/actions/init_col.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ bool InitCol::init(std::string *error) {
5353
bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
5454
std::string collectionName;
5555
collectionName = MacroExpansion::expand(m_collection_value, transaction);
56+
std::cout << "Collection is not implemented yet, here is the ";
57+
std::cout << "collection name: " << collectionName << std::endl;
5658
return true;
5759
}
5860

src/operators/rbl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, std::string ipStr,
114114
debug(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \
115115
+ std::to_string(days) + " " \
116116
"days since last activity, threat score " \
117-
+ std::to_string(score));
117+
+ std::to_string(score) + ". Case: " + ptype);
118118
}
119119

120120

src/utils.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ void chomp(std::string *str) {
125125

126126

127127
std::string tolower(std::string str) {
128-
std::locale loc;
129128
std::string value;
130129
value.resize(str.length());
131130

test/fuzzer/afl_fuzzer.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,13 @@ using namespace modsecurity;
116116

117117

118118
int main(int argc, char** argv) {
119-
size_t count;
120-
uint8_t buf[128];
121-
ssize_t read_bytes;
119+
uint8_t buf[128];
122120

123121
std::string lastString;
124122

125123
while (__AFL_LOOP(1000)) {
124+
ssize_t read_bytes;
126125
// (re-) initialize the library and read new input
127-
read_bytes = -1;
128126
memset(buf, 0, 128);
129127
read_bytes = read(STDIN_FILENO, buf, 128);
130128

0 commit comments

Comments
 (0)