public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] hfs: fix namelength memory corruption
@ 2008-09-08 13:35 Eric Sesterhenn
  2008-09-09  0:14 ` Andrew Morton
  2008-09-09  2:02 ` David Wagner
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sesterhenn @ 2008-09-08 13:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: zippel, akpm

hi,

this is basically the same as
hfsplus-fix-buffer-overflow-with-a-corrupted-image.patch.
We use the length parameter for a memcopy without checking it and
thereby corruption memory. 

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux/fs/hfs/catalog.c.orig	2008-09-08 15:20:15.000000000 +0200
+++ linux/fs/hfs/catalog.c	2008-09-08 15:21:02.000000000 +0200
@@ -190,6 +190,10 @@ int hfs_cat_find_brec(struct super_block
 
 	fd->search_key->cat.ParID = rec.thread.ParID;
 	len = fd->search_key->cat.CName.len = rec.thread.CName.len;
+	if (len > HFS_NAMELEN) {
+		printk(KERN_ERR "hfs: bad catalog namelength\n");
+		return -EIO;
+	}
 	memcpy(fd->search_key->cat.CName.name, rec.thread.CName.name, len);
 	return hfs_brec_find(fd);
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-09  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-08 13:35 [Patch] hfs: fix namelength memory corruption Eric Sesterhenn
2008-09-09  0:14 ` Andrew Morton
2008-09-09  2:02 ` David Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox