Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HFS too strict check #2879

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tsk/fs/hfs_dent.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,19 @@ hfs_dir_open_meta_cb(HFS_INFO * hfs, int8_t level_type,

/* This will link the folder to its parent, which is the ".." entry */
else if (rec_type == HFS_FOLDER_THREAD) {
if ((nodesize < sizeof(hfs_thread)) || (rec_off2 > nodesize - sizeof(hfs_thread))) {
size_t required_size = sizeof(hfs_thread) - sizeof(hfs_uni_str) + sizeof(((hfs_uni_str*)0)->length);
if ((nodesize < required_size) || (rec_off2 > nodesize - required_size)) {
tsk_error_set_errno(TSK_ERR_FS_GENFS);
tsk_error_set_errstr("hfs_dir_open_meta: nodesize value out of bounds");
return HFS_BTREE_CB_ERR;
}
hfs_thread* thread = (hfs_thread*) & rec_buf[rec_off2];
required_size += tsk_getu16(hfs->fs_info.endian, thread->name.length);
if ((nodesize < required_size) || (rec_off2 > nodesize - required_size)) {
tsk_error_set_errno(TSK_ERR_FS_GENFS);
tsk_error_set_errstr("hfs_dir_open_meta: nodesize value out of bounds");
return HFS_BTREE_CB_ERR;
}
hfs_thread *thread = (hfs_thread *) & rec_buf[rec_off2];
strcpy(info->fs_name->name, "..");
info->fs_name->meta_addr =
tsk_getu32(hfs->fs_info.endian, thread->parent_cnid);
Expand Down