[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_398177A566523D6B372E972A36064B5C7409@qq.com>
Date: Thu, 28 Nov 2024 20:31:10 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+c6811fc2262cec1e6266@...kaller.appspotmail.com
Cc: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] hfs: check key length before reading
The length of the key maybe too large. Add a key length check before reading
the key.
Reported-and-tested-by: syzbot+c6811fc2262cec1e6266@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c6811fc2262cec1e6266
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
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
Powered by blists - more mailing lists