Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
117d5d5a
Commit
117d5d5a
authored
2 years ago
by
Greg DiCristofaro
Browse files
Options
Downloads
Patches
Plain Diff
fixes
parent
ecaff4cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsk/fs/ntfs_dent.cpp
+21
-43
21 additions, 43 deletions
tsk/fs/ntfs_dent.cpp
with
21 additions
and
43 deletions
tsk/fs/ntfs_dent.cpp
+
21
−
43
View file @
117d5d5a
...
...
@@ -1023,9 +1023,9 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
return
TSK_COR
;
}
// Taking 128 MiB as an arbitrary upper bound
// Taking 128 MiB as an arbitrary upper bound
if
(
fs_attr_idx
->
nrd
.
allocsize
>
(
128
*
1024
*
1024
))
{
tsk_error_reset
();
tsk_error_reset
();
tsk_error_set_errno
(
TSK_ERR_FS_INODE_COR
);
tsk_error_set_errstr
(
"fs_attr_idx->nrd.allocsize value out of bounds"
);
...
...
@@ -1036,11 +1036,11 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
* Copy the index allocation run into a big buffer
*/
idxalloc_len
=
fs_attr_idx
->
nrd
.
allocsize
;
// default to null unless length is greater than 0
idxalloc
=
NULL
;
if
((
idxalloc_len
>
0
)
&&
((
idxalloc
=
(
char
*
)
tsk_malloc
((
size_t
)
idxalloc_len
))
==
NULL
))
{
return
TSK_ERR
;
}
// default to null unless length is greater than 0
idxalloc
=
NULL
;
if
((
idxalloc_len
>
0
)
&&
((
idxalloc
=
(
char
*
)
tsk_malloc
((
size_t
)
idxalloc_len
))
==
NULL
))
{
return
TSK_ERR
;
}
/* Fill in the loading data structure */
load_file
.
total
=
load_file
.
left
=
(
size_t
)
idxalloc_len
;
...
...
@@ -1050,21 +1050,17 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
tsk_fprintf
(
stderr
,
"ntfs_dir_open_meta: Copying $IDX_ALLOC into buffer
\n
"
);
if
(
tsk_fs_attr_walk
(
fs_attr_idx
,
TSK_FS_FILE_WALK_FLAG_SLACK
,
tsk_fs_load_file_action
,
(
void
*
)
&
load_file
))
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
if
(
tsk_fs_attr_walk
(
fs_attr_idx
,
TSK_FS_FILE_WALK_FLAG_SLACK
,
tsk_fs_load_file_action
,
(
void
*
)
&
load_file
))
{
free
(
idxalloc
);
tsk_error_errstr2_concat
(
" - ntfs_dir_open_meta"
);
return
TSK_COR
;
// this could be an error though
}
/* Not all of the directory was copied, so we exit */
if
(
load_file
.
left
>
0
)
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
tsk_error_reset
();
tsk_error_set_errno
(
TSK_ERR_FS_FWALK
);
...
...
@@ -1099,9 +1095,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
tsk_error_set_errno
(
TSK_ERR_FS_INODE_COR
);
tsk_error_set_errstr
(
"ntfs_dir_open_meta: Not enough data in idxalloc buffer for an idxrec."
);
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1141,9 +1135,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
/* remove the update sequence in the index record */
if
(
ntfs_fix_idxrec
(
ntfs
,
idxrec_p
,
rec_len
))
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1169,9 +1161,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
tsk_error_set_errstr
(
"Error: Index list offsets are invalid on entry: %"
PRIuINUM
,
fs_dir
->
fs_file
->
meta
->
addr
);
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1185,9 +1175,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
idxelist
->
begin_off
));
// stop if we get an error, record if we get corruption
if
(
retval_tmp
==
TSK_ERR
)
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_ERR
;
}
else
if
(
retval_tmp
==
TSK_COR
)
{
...
...
@@ -1216,9 +1204,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
/* remove the update sequence */
if
(
ntfs_fix_idxrec
(
ntfs
,
idxrec_p
,
rec_len
))
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1229,9 +1215,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
tsk_error_set_errstr
(
"Error: Index list offsets are invalid on entry: %"
PRIuINUM
,
fs_dir
->
fs_file
->
meta
->
addr
);
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1253,9 +1237,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
tsk_error_set_errstr
(
"Error: Index list offsets are invalid on entry: %"
PRIuINUM
,
fs_dir
->
fs_file
->
meta
->
addr
);
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_COR
;
}
...
...
@@ -1268,9 +1250,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
idxelist
->
begin_off
));
// stop if we get an error, record if we get corruption
if
(
retval_tmp
==
TSK_ERR
)
{
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
return
TSK_ERR
;
}
else
if
(
retval_tmp
==
TSK_COR
)
{
...
...
@@ -1278,9 +1258,7 @@ ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,
}
}
if
(
idxalloc
!=
NULL
)
{
free
(
idxalloc
);
}
free
(
idxalloc
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment