]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: fix potential free() of garbage in ext2fs_update_bb_inode()
authorTheodore Ts'o <tytso@mit.edu>
Mon, 20 Dec 2010 15:57:29 +0000 (10:57 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 20 Dec 2010 15:58:58 +0000 (10:58 -0500)
There was a potential of freeing an uninitialized pointer in
rec.block_buf, which was pointed out by Namhyung Kim <namhyung@gmail.com>

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/bb_inode.c

index 0b79b16451ad2233895121963d6ce1a252fd3a9f..0b6c3dd2af90cc8ecad052f42d6e8ebbec2b4c7c 100644 (file)
@@ -65,8 +65,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
        if (!fs->block_map)
                return EXT2_ET_NO_BLOCK_BITMAP;
 
-       rec.bad_block_count = 0;
-       rec.ind_blocks_size = rec.ind_blocks_ptr = 0;
+       memset(&rec, 0, sizeof(rec));
        rec.max_ind_blocks = 10;
        retval = ext2fs_get_array(rec.max_ind_blocks, sizeof(blk_t),
                                &rec.ind_blocks);