Whamcloud - gitweb
libext2fs: avoid buffer overflow if s_first_meta_bg is too big
authorTheodore Ts'o <tytso@mit.edu>
Sat, 9 Aug 2014 16:24:54 +0000 (12:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 10 Aug 2014 20:20:59 +0000 (16:20 -0400)
commitf66e6ce4446738c2c7f43d41988a3eb73347e2f5
treea9e05d6bcc5b921222ff5929c7696d930ef46882
parentf00948ad1df100c7d616ef6fbf7609329a2e4001
libext2fs: avoid buffer overflow if s_first_meta_bg is too big

If s_first_meta_bg is greater than the of number block group
descriptor blocks, then reading or writing the block group descriptors
will end up overruning the memory buffer allocated for the
descriptors.  Fix this by limiting first_meta_bg to no more than
fs->desc_blocks.  This doesn't correct the bad s_first_meta_bg value,
but it avoids causing the e2fsprogs userspace programs from
potentially crashing.

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