]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/hfs/catalog.c
hfs: fix a potential buffer overflow
[karo-tx-linux.git] / fs / hfs / catalog.c
index 6d98f116ca03d610a1477dc77558c899f5abe48d..424b0337f5244b150fcad3fb67b9ef8cb93ae932 100644 (file)
@@ -289,6 +289,10 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
        err = hfs_brec_find(&src_fd);
        if (err)
                goto out;
+       if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
+               err = -EIO;
+               goto out;
+       }
 
        hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
                            src_fd.entrylength);