From: Darrick J. Wong Date: Tue, 4 Nov 2014 16:47:30 +0000 (-0500) Subject: libext2fs: zero the EA block buffer before filling it X-Git-Tag: v1.43-WIP-2015-05-18~144 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=bab25cb7a7e2b042926748a96cadc386e3de6c6a;p=tools%2Fe2fsprogs.git libext2fs: zero the EA block buffer before filling it When writing an extended attribute (EA) block, it's quite possible that the EA formatting code will not write the entire buffer. Therefore, we must zero the buffer beforehand to avoid writing random heap contents to disk. Signed-off-by: Darrick J. Wong Reported-by: Sami Liedes Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index b52abb5..c397e00 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -550,7 +550,7 @@ errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle) write_ea_block: /* Write the EA block */ - err = ext2fs_get_mem(handle->fs->blocksize, &block_buf); + err = ext2fs_get_memzero(handle->fs->blocksize, &block_buf); if (err) goto out;