[PATCH] hfs: check key length before reading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The length of the key maybe too large. Add a key length check before reading
the key.

Reported-and-tested-by: syzbot+c6811fc2262cec1e6266@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=c6811fc2262cec1e6266
Signed-off-by: Edward Adam Davis <eadavis@xxxxxx>
---
 fs/hfs/bnode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c
index 6add6ebfef89..6e38d61da36f 100644
--- a/fs/hfs/bnode.c
+++ b/fs/hfs/bnode.c
@@ -67,6 +67,9 @@ void hfs_bnode_read_key(struct hfs_bnode *node, void *key, int off)
 	else
 		key_len = tree->max_key_len + 1;
 
+	if (key_len > tree->max_key_len + 1)
+		return;
+
 	hfs_bnode_read(node, key, off, key_len);
 }
 
-- 
2.47.0





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux