mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 17:41:52 +03:00
Make all "rule id" variables of type RuleId
Previously, ModSecurity inconsistently used RuleId, int and double for rule id variables in different places.
This commit is contained in:
@@ -26,18 +26,16 @@ namespace actions {
|
||||
bool RuleId::init(std::string *error) {
|
||||
std::string a = m_parserPayload;
|
||||
|
||||
try {
|
||||
m_ruleId = std::stod(a);
|
||||
} catch (...) {
|
||||
std::istringstream iss(a);
|
||||
iss >> m_ruleId;
|
||||
if (iss.fail()) {
|
||||
m_ruleId = 0;
|
||||
error->assign("The input \"" + a + "\" does not " \
|
||||
"seems to be a valid rule id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << std::setprecision(40) << m_ruleId;
|
||||
if (a != oss.str() || m_ruleId < 0) {
|
||||
if (a != std::to_string(m_ruleId) || m_ruleId < 0) {
|
||||
error->assign("The input \"" + a + "\" does not seems " \
|
||||
"to be a valid rule id.");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user