mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
validateByteRange: correctly handle bytes > 127
ValidateByteRange::evaluate compared bytes with values in range [0-255], but acquired bytes by indexing std::string, which gave type char, which is signed. So bytes with values more than 127 were treated as negative, resulting in being incorrectly classified as out-of-range. This commit adds casting byte values to unsigned char before validating range.
This commit is contained in:
parent
7665d96a13
commit
86e74fac58
@ -116,7 +116,7 @@ bool ValidateByteRange::evaluate(Transaction *transaction, Rule *rule,
|
||||
|
||||
size_t count = 0;
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
int x = input.at(i);
|
||||
int x = (unsigned char) input.at(i);
|
||||
if (!(table[x >> 3] & (1 << (x & 0x7)))) {
|
||||
// debug(9, "Value " + std::to_string(x) + " in " +
|
||||
// input + " ouside range: " + param);
|
||||
|
Loading…
x
Reference in New Issue
Block a user