aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 10:40:26 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 10:41:49 +0200
commit89d5c4a4c00ba11e5087f86ae35b76895a06220b (patch)
tree3cbc96e168def5584615af2bcf841d52bcf32bc7 /lib/sqfs
parentd2939161c783c8394ac995d44995fb028731ac28 (diff)
Fix zero padding of extracted data blocks
Only padd it if the *extracted* size is less then block size. Doing it with the compressed size results in garbled blocks. Especially because most of them are less than block size when compressed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/data_reader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index 2b111db..18719fe 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -75,8 +75,8 @@ static int precache_data_block(data_reader_t *data, off_t location,
if (ret < 0)
return -1;
- if (size < data->block_size)
- memset((char *)data->block + size, 0, data->block_size - size);
+ if ((size_t)ret < data->block_size)
+ memset((char *)data->block + ret, 0, data->block_size - ret);
data->current_block = location;
return 0;