Skip to content

Commit d9101a4

Browse files
authored
Merge pull request #3306 from airween/v3/time_mon_fix
fix: align TIME_MON variable's behavior
2 parents fd45641 + daf550e commit d9101a4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/variables/time_mon.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void TimeMon::evaluate(Transaction *transaction,
4646
struct tm timeinfo;
4747
localtime_r(&timer, &timeinfo);
4848

49-
transaction->m_variableTimeMin.assign(std::to_string(timeinfo.tm_mon));
49+
transaction->m_variableTimeMin.assign(std::to_string(timeinfo.tm_mon + 1));
5050

5151
l->push_back(new VariableValue(&m_retName,
5252
&transaction->m_variableTimeMin));

test/test-cases/regression/variable-TIME_MON.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
]
3434
},
3535
"expected":{
36-
"debug_log":"Target value: \"([0-9]+)\" \\(Variable: TIME_MON\\)"
36+
"http_code": 200,
37+
"debug_log":"Target value: \"([1-9]|1[012])\" \\(Variable: TIME_MON\\)"
3738
},
3839
"rules":[
3940
"SecRuleEngine On",

0 commit comments

Comments
 (0)