mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
bugfix: fix overflow risk of strlen function
This commit is contained in:
parent
2731a3384b
commit
4d4940dfbe
@ -323,7 +323,8 @@ void addExpression(NG &ng, unsigned index, const char *expression,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that our pattern isn't too long (in characters).
|
// Ensure that our pattern isn't too long (in characters).
|
||||||
if (strlen(expression) > cc.grey.limitPatternLength) {
|
size_t maxlen = cc.grey.limitPatternLength + 1;
|
||||||
|
if (strnlen(expression, maxlen) >= maxlen) {
|
||||||
throw CompileError("Pattern length exceeds limit.");
|
throw CompileError("Pattern length exceeds limit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user