Fix potential buffer overflow
Under certain circumstances, it would be possible for a too-large number sent cause a buffer overflow by passing a too-large endpos.
This commit is contained in:
parent
eca9597635
commit
e6d662e6b9
1 changed files with 1 additions and 0 deletions
|
|
@ -312,6 +312,7 @@ proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Opt
|
|||
result.pcreMatchBounds.setLen(vecsize div 3)
|
||||
|
||||
let strlen = if endpos == int.high: str.len else: endpos+1
|
||||
doAssert(strlen <= str.len) # don't want buffer overflows
|
||||
|
||||
let execRet = pcre.exec(pattern.pcreObj,
|
||||
pattern.pcreExtra,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue