mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-29 19:37:06 -05:00
Fix undefined behavior in STREAM buffer bounds checking by avoiding out-of-bounds pointer arithmetic
This commit is contained in:
parent
3185e1bf34
commit
608393867a
2 changed files with 4 additions and 3 deletions
|
|
@ -277,7 +277,7 @@ int sdeplete(STREAM* s, unsigned char* last)
|
|||
|
||||
while (1) {
|
||||
/* increase the position up to 4 bytes before the end */
|
||||
if (s->pos + 4 <= s->end)
|
||||
if (s->end - s->pos >= 4)
|
||||
s->pos = s->end - 4;
|
||||
|
||||
/* insert the last 4 bytes */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue