summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-29 08:57:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-29 09:56:32 +0100
commitb1e22e2b03dfbb143dfac3a810ba9a8cae6058d8 (patch)
treee9d9a997b8dd78c8cf4efb52866d9c9646242b91 /fs
parent27ee6010f89b4b2cd1e9e05975c1af2887ef04c5 (diff)
downloadbarebox-b1e22e2b03dfbb143dfac3a810ba9a8cae6058d8.tar.gz
fs: ext4: Fix out of bounds memset
When a block we read is a sparse block, we memset the corresponding output buffer to zero. If that block is the last block we read, we may not memset the whole block, but only up to the length of the output buffer, which may be shorter than a full block. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index bfc5f27..acecccd 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -135,7 +135,7 @@ int ext4fs_read_file(struct ext2fs_node *node, int pos,
return ret;
previous_block_number = -1;
}
- memset(buf, 0, blocksize - skipfirst);
+ memset(buf, 0, blockend);
}
buf += blocksize - skipfirst;
}