summaryrefslogtreecommitdiff
path: root/lib/sqfs/frag_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/frag_reader.c')
-rw-r--r--lib/sqfs/frag_reader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqfs/frag_reader.c b/lib/sqfs/frag_reader.c
index 721286c..51b40e9 100644
--- a/lib/sqfs/frag_reader.c
+++ b/lib/sqfs/frag_reader.c
@@ -110,8 +110,8 @@ frag_reader_t *frag_reader_create(sqfs_super_t *super, int fd,
goto fail;
diff = SQFS_META_BLOCK_SIZE / sizeof(tbl[0]);
- if (diff > count)
- diff = count;
+ if (diff > (count - j))
+ diff = count - j;
if (meta_reader_read(m, tbl + j, diff * sizeof(tbl[0])))
goto fail;