Whamcloud - gitweb
libext2fs: directory iteration mustn't walk off the buffer end
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 25 Oct 2014 20:56:42 +0000 (13:56 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Nov 2014 16:39:51 +0000 (11:39 -0500)
commitdab7435917698bb490cce61fc8be1be0a862cf66
tree062272199fb3f135af0fb0728d9630412173f5fc
parent160f131deed7d3db2aa958051eef7ae8fafa8539
libext2fs: directory iteration mustn't walk off the buffer end

When we're iterating a directory, the loop control code reads the
length of the next directory record, failing to account for the fact
that there must be at least 8 bytes (the minimum size of a directory
entry) left in the buffer to read the next directory record.  Fix the
loop conditional so that we don't read off the end of the buffer.

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/dir_iterate.c