Fix reading more than a block but less than the rest of the file
Jeffrey Pfau jeffrey@endrift.com
Thu, 17 Jul 2014 02:51:38 -0700
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/util/vfs-zip.c
→
src/util/vfs-zip.c
@@ -134,8 +134,8 @@ while (bytesRead < size) {
if (vfz->offset < vfz->readSize) { size_t diff = vfz->readSize - vfz->offset; void* start = &((uint8_t*) vfz->buffer)[vfz->offset]; - if (diff > size) { - diff = size; + if (diff > size - bytesRead) { + diff = size - bytesRead; } if (buffer) { void* bufferOffset = &((uint8_t*) buffer)[bytesRead];