ITADN

Prevent out-of-bounds writes in GetTempate

#1577Pull RequestPeterDaveHello 创建于 12 天前
codexReview effort 1/5aardvark
P
PeterDaveHellocommented
### Motivation `GetTempate` in `addtorrent.pas` parses space-separated template entries into a fixed-size destination array without checking its bounds. Supplying more entries than the array can hold may cause an out-of-bounds write or a range-check exception. ### Description - Check `High(e)` before writing to `e[n]`. - Stop parsing when the destination array is full. - Preserve the existing behavior for entries that fit within the array. ### Testing - Verified that the bounds check occurs before the array write. - Confirmed that oversized input stops parsing once the destination array is full.
合并状态:未合并 6 条评论