]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/squashfs/dir.c
Squashfs: update email address
[mirror_ubuntu-bionic-kernel.git] / fs / squashfs / dir.c
index 0dc340aa2be97d5373e719f74c84d866e00ef465..9dfe2ce0fb70f0b0caee3d14c9f0f3026bf5d3f4 100644 (file)
@@ -2,7 +2,7 @@
  * Squashfs - a compressed read only filesystem for Linux
  *
  * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
- * Phillip Lougher <phillip@lougher.demon.co.uk>
+ * Phillip Lougher <phillip@squashfs.org.uk>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -172,6 +172,11 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
                length += sizeof(dirh);
 
                dir_count = le32_to_cpu(dirh.count) + 1;
+
+               /* dir_count should never be larger than 256 */
+               if (dir_count > 256)
+                       goto failed_read;
+
                while (dir_count--) {
                        /*
                         * Read directory entry.
@@ -183,6 +188,10 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
                        size = le16_to_cpu(dire->size) + 1;
 
+                       /* size should never be larger than SQUASHFS_NAME_LEN */
+                       if (size > SQUASHFS_NAME_LEN)
+                               goto failed_read;
+
                        err = squashfs_read_metadata(inode->i_sb, dire->name,
                                        &block, &offset, size);
                        if (err < 0)