Squashfs: add corruption check in get_dir_index_using_offset()
authorPhillip Lougher <phillip@squashfs.org.uk>
Tue, 3 Sep 2013 03:52:52 +0000 (04:52 +0100)
committerMohamad Ayyash <mkayyash@google.com>
Wed, 4 Mar 2015 19:21:43 +0000 (11:21 -0800)
commit4fed250b48dc5033a0fcada7aa2ca77f507c7ddc
tree87a02d557b7550ec5f38f77d3ea074237c686db2
parent4ff8d316da73165acdda9682ac0413b2a141c6d6
Squashfs: add corruption check in get_dir_index_using_offset()

We read the size (of the name) field from disk.  This value should
be sanity checked for correctness to avoid blindly reading
huge amounts of unnecessary data from disk on corruption.

Note, here we're not actually reading the name into a buffer, but
skipping it, and so corruption doesn't cause buffer overflow, merely
lots of unnecessary amounts of data to be read.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
fs/squashfs/dir.c