UDF symlink pathComponent header OOB read
PATCH 1/1 UDF symlink pathComponent header OOB read
udf_symlink_filler() can enter udf_pc_to_char() with a partial pathComponent header.
Validate that enough input remains for a complete pathComponent header before accessing it. Reject malformed symlink data that would otherwise make udf_pc_to_char() perform an out-of-bounds read.
---
Trail of Bits has a reproducer that triggers a kernel panic demonstrating this bug and can share it if needed.
fs/udf/symlink.c | 2 ++
1 file changed, 2 insertions(+)
fs/udf/symlink.c +2 -0
@@ -36,6 +36,8 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,/* Reserve one byte for terminating \0 */ tolen--;while (elen < fromlen) { +if (fromlen - elen <sizeof (struct pathComponent )) +return -EIO ; pc = (struct pathComponent *)(from + elen); elen +=sizeof (struct pathComponent );switch (pc->componentType) {
Quoted 9 lines · David Lee
udf_symlink_filler()can enterudf_pc_to_char()with a partial pathComponent header.Validate that enough input remains for a complete pathComponent header before accessing it. Reject malformed symlink data that would otherwise make
udf_pc_to_char()perform an out-of-bounds read.Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Signed-off-by David Lee <[email protected]>Assisted-by Codex:gpt-5.5
Thanks! I've added the patch to my tree.
Honza
Quoted 20 lines
---
Trail of Bits has a reproducer that triggers a kernel panic demonstrating this bug and can share it if needed.
fs/udf/symlink.c| 2 ++1 file changed, 2 insertions(+)fs/udf/symlink.c +2
-0@@ -36,6 +36,8 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,/* Reserve one byte for terminating \0 */ tolen--;while (elen < fromlen) { +if (fromlen - elen <sizeof (struct pathComponent )) +return -EIO ; pc = (struct pathComponent *)(from + elen); elen +=sizeof (struct pathComponent );switch (pc->componentType) {
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR