]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: zero the EA block buffer before filling it
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 4 Nov 2014 16:47:30 +0000 (11:47 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Nov 2014 16:47:30 +0000 (11:47 -0500)
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 <darrick.wong@oracle.com>
Reported-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext_attr.c

index b52abb5be0fa6a7b4e4670dbbaf7f46cd58deb21..c397e00a0b53839c373c58cd56af5a499f596312 100644 (file)
@@ -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;