Skip to content
Snippets Groups Projects
Unverified Commit 2a9a69bd authored by Brian Carrier's avatar Brian Carrier Committed by GitHub
Browse files

Merge pull request #1102 from APriestman/3464_infiniteLoop

Add check that the extended partition has not already been added
parents e5843b15 ee1abeed
No related branches found
No related tags found
No related merge requests found
...@@ -751,6 +751,29 @@ dos_load_ext_table(TSK_VS_INFO * vs, TSK_DADDR_T sect_cur, ...@@ -751,6 +751,29 @@ dos_load_ext_table(TSK_VS_INFO * vs, TSK_DADDR_T sect_cur,
* in extended partitions */ * in extended partitions */
if (dos_is_ext(part->ptype)) { if (dos_is_ext(part->ptype)) {
TSK_VS_PART_INFO *part_info;
/* Sanity check to prevent infinite recursion in dos_load_ext_table.
* If we already have a partition with this starting address then
* return an error. This will prevent any more partitions from being
* added but will leave any existing partitions alone. */
part_info = vs->part_list;
while (part_info != NULL) {
if (part_info->start == (TSK_DADDR_T)(sect_ext_base + part_start)) {
if (tsk_verbose)
tsk_fprintf(stderr,
"Starting sector %" PRIuDADDR
" of extended partition has already been used\n",
(TSK_DADDR_T)(sect_ext_base + part_start));
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_VS_BLK_NUM);
tsk_error_set_errstr
("dos_load_ext_table: Loop in partition table detected");
return 1;
}
part_info = part_info->next;
}
/* part start is added to the start of the /* part start is added to the start of the
* first extended partition (the primary * first extended partition (the primary
* extended partition) */ * extended partition) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment