Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 1 commit
  • 2 files changed
  • 0 comments
  • 1 contributor
May 04, 2012
Greg Kroah-Hartman hfsplus: Fix potential buffer overflows
Commit ec81aec ("hfs: fix a potential buffer overflow") fixed a few
potential buffer overflows in the hfs filesystem.  But as Timo Warns
pointed out, these changes also need to be made on the hfsplus
filesystem as well.

Reported-by: Timo Warns <warns@pre-sense.de>
Acked-by: WANG Cong <amwang@redhat.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Miklos Szeredi <mszeredi@suse.cz>
Cc: Sage Weil <sage@newdream.net>
Cc: Eugene Teo <eteo@redhat.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Dave Anderson <anderson@redhat.com>
Cc: stable <stable@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6f24f89
4  fs/hfsplus/catalog.c
@@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid,
366 366
 	err = hfs_brec_find(&src_fd);
367 367
 	if (err)
368 368
 		goto out;
  369
+	if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
  370
+		err = -EIO;
  371
+		goto out;
  372
+	}
369 373
 
370 374
 	hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
371 375
 				src_fd.entrylength);
11  fs/hfsplus/dir.c
@@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
150 150
 		filp->f_pos++;
151 151
 		/* fall through */
152 152
 	case 1:
  153
+		if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
  154
+			err = -EIO;
  155
+			goto out;
  156
+		}
  157
+
153 158
 		hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
154 159
 			fd.entrylength);
155 160
 		if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
@@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
181 186
 			err = -EIO;
182 187
 			goto out;
183 188
 		}
  189
+
  190
+		if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
  191
+			err = -EIO;
  192
+			goto out;
  193
+		}
  194
+
184 195
 		hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
185 196
 			fd.entrylength);
186 197
 		type = be16_to_cpu(entry.type);

No commit comments for this range

Something went wrong with that request. Please try again.