mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 19:47:43 +03:00
bugfix: fix overflow risk of strlen function
This commit is contained in:
committed by
Konstantinos Margaritis
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user