diff --git a/lib/libarchive/archive_read_open_memory.c b/lib/libarchive/archive_read_open_memory.c index e87ef7802127..b32a6f3abf3e 100644 --- a/lib/libarchive/archive_read_open_memory.c +++ b/lib/libarchive/archive_read_open_memory.c @@ -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; (void)a; /* UNUSED */ - if (mine->buffer + skip > mine->end) + if (skip > mine->end - mine->buffer) skip = mine->end - mine->buffer; /* Round down to block size. */ skip /= mine->read_size;