From 89d5c4a4c00ba11e5087f86ae35b76895a06220b Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 7 Aug 2019 10:40:26 +0200 Subject: 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 --- lib/sqfs/data_reader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqfs/data_reader.c') 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; -- cgit v1.2.3