hfsplus: Fix potential buffer overflows
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/1 hfsplus: Fix potential buffer overflows
commit ec81aecb29668ad71f699f4e7b96ec46691895b6 (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 <[email protected]>
Cc WANG Cong <[email protected]>
Cc Alexey Khoroshilov <[email protected]>
Cc Cong Wang <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Sage Weil <[email protected]>
Cc Eugene Teo <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Al Viro <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Alexey Dobriyan <[email protected]>
Cc Dave Anderson <[email protected]>
Cc stable <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Linus Torvalds <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
--- fs/hfsplus/catalog.c | 4 ++++ fs/hfsplus/dir.c | 11 +++++++++++ 2 files changed, 15 insertions(+)
fs/hfsplus/catalog.c +4 -0
@@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid, err =hfs_brec_find (&src_fd);if (err) goto out; +if (src_fd.entrylength >sizeof (entry) || src_fd.entrylength <0 ) { + err = -EIO ; + goto out; + }hfs_bnode_read (src_fd.bnode, &entry, src_fd.entryoffset, src_fd.entrylength);
fs/hfsplus/dir.c +11 -0
@@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file * filp->f_pos++;/* fall through */ case 1 : +if (fd.entrylength >sizeof (entry) || fd.entrylength <0 ) { + err = -EIO ; + goto out; + } +hfs_bnode_read (fd.bnode, &entry, fd.entryoffset, fd.entrylength);if (be16_to_cpu (entry.type) !=HFSPLUS_FOLDER_THREAD ) {
@@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file * err = -EIO ; goto out; } + +if (fd.entrylength >sizeof (entry) || fd.entrylength <0 ) { + err = -EIO ; + goto out; + } +hfs_bnode_read (fd.bnode, &entry, fd.entryoffset, fd.entrylength); type =be16_to_cpu (entry.type);
Quoted 3 lines · Greg Kroah-Hartman
Reported-by Timo Warns <[email protected]>Cc WANG Cong <[email protected]>
Tssk. You got an ack at least from Cong.
Quoted 2 lines
Cc Alexey Khoroshilov <[email protected]>Cc Cong Wang <[email protected]>
.. who you have listed twice with just a cc.
Linus
Greg Kroah-Hartman
maintainerQuoted 7 lines · Linus Torvalds
Quoted 3 lines · Greg Kroah-Hartman
Reported-by Timo Warns <[email protected]>Cc WANG Cong <[email protected]>Tssk. You got an ack at least from Cong.
Oops, you are right, sorry.
Quoted 4 lines
Quoted 2 lines
Cc Alexey Khoroshilov <[email protected]>Cc Cong Wang <[email protected]>.. who you have listed twice with just a cc.
Ugh, my fault, sorry.
greg k-h