mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
hfs: fix namelength memory corruption
Fix a stack corruption caused by a corrupted hfs filesystem. If the catalog name length is corrupted the memcpy overwrites the catalog btree structure. Since the field is limited to HFS_NAMELEN bytes in the structure and the file format, we throw an error if it is too long. Cc: Roman Zippel <[email protected]> Signed-off-by: Eric Sesterhenn <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
649f1ee6c7
commit
d38b7aa7fc
1 changed files with 4 additions and 0 deletions
|
|
@ -190,6 +190,10 @@ int hfs_cat_find_brec(struct super_block *sb, u32 cnid,
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue