mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 13:22:48 +00:00
Avoid a potential overflow when 'skip' is larger than a pointer.
Thanks to: Joerg Sonnenberger
This commit is contained in:
parent
25d4e0e5ab
commit
96e31e81ff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168233
@ -134,7 +134,7 @@ memory_read_skip(struct archive *a, void *client_data, off_t skip)
|
|||||||
struct read_memory_data *mine = (struct read_memory_data *)client_data;
|
struct read_memory_data *mine = (struct read_memory_data *)client_data;
|
||||||
|
|
||||||
(void)a; /* UNUSED */
|
(void)a; /* UNUSED */
|
||||||
if (mine->buffer + skip > mine->end)
|
if (skip > mine->end - mine->buffer)
|
||||||
skip = mine->end - mine->buffer;
|
skip = mine->end - mine->buffer;
|
||||||
/* Round down to block size. */
|
/* Round down to block size. */
|
||||||
skip /= mine->read_size;
|
skip /= mine->read_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user