[PATCH 1/4] fs: ext4: Fix out of bounds memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 fs/ext4/ext4fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index bfc5f27cc3..acecccd6b9 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;
 	}
-- 
2.24.0.rc1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux