diff options
author | Christoph Hellwig <hch@tuxera.com> | 2010-10-14 09:54:23 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-10-14 09:54:23 -0400 |
commit | 13571a6977f821fab7d9c3cc5f75da52b7732e40 (patch) | |
tree | 32b50f122fc37256d3ff8ad40ec905d0c3e540ea /fs/hfsplus/brec.c | |
parent | 9250f925972d03ccc0c0a4dd4e9b794d2ef6d52b (diff) | |
download | lwn-13571a6977f821fab7d9c3cc5f75da52b7732e40.tar.gz lwn-13571a6977f821fab7d9c3cc5f75da52b7732e40.zip |
hfsplus: validate btree flags
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/brec.c')
-rw-r--r-- | fs/hfsplus/brec.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c index 790cd6a8605d..2f39d05443e1 100644 --- a/fs/hfsplus/brec.c +++ b/fs/hfsplus/brec.c @@ -42,20 +42,12 @@ u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec) recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2); if (!recoff) return 0; - if (node->tree->attributes & HFS_TREE_BIGKEYS) { - retval = hfs_bnode_read_u16(node, recoff) + 2; - if (retval > node->tree->max_key_len + 2) { - printk(KERN_ERR "hfs: keylen %d too large\n", - retval); - retval = 0; - } - } else { - retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1; - if (retval > node->tree->max_key_len + 1) { - printk(KERN_ERR "hfs: keylen %d too large\n", - retval); - retval = 0; - } + + retval = hfs_bnode_read_u16(node, recoff) + 2; + if (retval > node->tree->max_key_len + 2) { + printk(KERN_ERR "hfs: keylen %d too large\n", + retval); + retval = 0; } } return retval; |