aboutsummaryrefslogtreecommitdiff
path: root/squashfs-tools
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@squashfs.org.uk>2013-01-21 04:04:34 +0000
committerPhillip Lougher <phillip@squashfs.org.uk>2013-01-22 04:48:02 +0000
commitafae5ccd46a631194b65fde2f97101fd42f10338 (patch)
treea00b4995342961d9d4ecc579ab25b4a73aa464ac /squashfs-tools
parent3e03d4a4608a8a5ca5bd5c894765aa8e183173fc (diff)
downloadsquashfs-tools-afae5ccd46a631194b65fde2f97101fd42f10338.tar.gz
read_fs: check metadata blocks are expected size in scan_inode_table()
Note we can't use expected in read_block() here because at the time of calling read_block() we don't know what the expected size is. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Diffstat (limited to 'squashfs-tools')
-rw-r--r--squashfs-tools/read_fs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/squashfs-tools/read_fs.c b/squashfs-tools/read_fs.c
index 6fa7a71..b038193 100644
--- a/squashfs-tools/read_fs.c
+++ b/squashfs-tools/read_fs.c
@@ -156,7 +156,19 @@ int scan_inode_table(int fd, long long start, long long end,
free(*inode_table);
return FALSE;
}
+
bytes += byte;
+
+ /* If this is not the last metadata block in the inode table
+ * then it should be SQUASHFS_METADATA_SIZE in size.
+ * Note, we can't use expected in read_block() above for this
+ * because we don't know if this is the last block until
+ * after reading.
+ */
+ if(start != end && byte != SQUASHFS_METADATA_SIZE) {
+ free(*inode_table);
+ return FALSE;
+ }
}
/*