Skip to content

Commit 2987067

Browse files
committed
Handle ConfigFileMode overflow and simplify regression test
1 parent d5d925f commit 2987067

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

headers/modsecurity/rules_set_properties.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ class ConfigFileMode : public ConfigUnsignedInt {
267267
return false;
268268
}
269269

270+
if(val > std::numeric_limits<uint32_t>::max()) {
271+
if(errmsg) {
272+
*errmsg = "Value is too big.";
273+
}
274+
return false;
275+
}
276+
270277
m_value = static_cast<uint32_t>(val);
271278
m_set = true;
272279
return true;
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
#!/usr/bin/lua
22

33
function main(filename)
4-
local pipe = io.popen(string.format("stat -c %%a %q", filename), "r")
5-
if pipe == nil then
4+
local file = io.open(filename, "r")
5+
if file == nil then
66
return nil
77
end
88

9-
local mode = pipe:read("*l")
10-
pipe:close()
11-
12-
if mode == "600" then
13-
return "1"
14-
end
15-
16-
return nil
9+
file:close()
10+
return "1"
1711
end

0 commit comments

Comments
 (0)