diff options
author | Colin Finck <colin@reactos.org> | 2021-08-09 23:15:34 +0300 |
---|---|---|
committer | Colin Finck <colin@reactos.org> | 2021-08-09 23:15:34 +0300 |
commit | 749398cf3247e2d63f794ce6d02217f8aa07d811 (patch) | |
tree | 59a667514eb6a951051dedc09deee6e9ab054380 | |
parent | 789fb57d9871967a5026e900abab9bb69d683351 (diff) |
Skip the empty "last entry" in the `NtfsIndexEntries` iterator.
Testing shows that there are NTFS filesystems that have a last index entry *without* a subnode (i.e. with no useful information at all).
-rw-r--r-- | src/index.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/index.rs b/src/index.rs index f9769d9..6f8d18c 100644 --- a/src/index.rs +++ b/src/index.rs @@ -2,7 +2,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later use crate::error::{NtfsError, Result}; -use crate::index_entry::{IndexEntryRange, IndexNodeEntryRanges, NtfsIndexEntry}; +use crate::index_entry::{ + IndexEntryRange, IndexNodeEntryRanges, NtfsIndexEntry, NtfsIndexEntryFlags, +}; use crate::indexes::NtfsIndexEntryType; use crate::structured_values::{NtfsIndexAllocation, NtfsIndexRoot}; use alloc::vec::Vec; @@ -136,8 +138,9 @@ where // has been fully iterated. self.inner_iterators.push(subnode_iter); self.following_entries.push(entry_range); - } else { - // There is no subnode, so our `entry` is next lexicographically. + } else if !entry.flags().contains(NtfsIndexEntryFlags::LAST_ENTRY) { + // There is no subnode, and this is not the empty "last entry", + // so our `entry` comes next lexicographically. break entry_range; } } else { |