From 15e288dbee06bb85cb11ca37505dcf7d5e76677d Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Sun, 5 Dec 2021 19:49:42 +0100 Subject: Fix `NtfsAttributeListNonResidentAttributeValue::len`. It previously returned the length reported by the current data run. This is correct for the first data run, but breaks when the reader moved to a subsequent one. Which is why we now save the length passed to us at creation time. --- src/attribute_value/attribute_list_non_resident.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/attribute_value/attribute_list_non_resident.rs b/src/attribute_value/attribute_list_non_resident.rs index f85bec6..cbf0636 100644 --- a/src/attribute_value/attribute_list_non_resident.rs +++ b/src/attribute_value/attribute_list_non_resident.rs @@ -27,6 +27,8 @@ pub struct NtfsAttributeListNonResidentAttributeValue<'n, 'f> { initial_attribute_list_entries: NtfsAttributeListEntries<'n, 'f>, /// Iterator through all connected attributes of this attribute in the AttributeList. connected_entries: AttributeListConnectedEntries<'n, 'f>, + /// Total length of the value data, in bytes. + data_size: u64, /// File, location, and data runs iteration state of the current attribute. attribute_state: Option>, /// Iteration state of the current data run. @@ -48,6 +50,7 @@ impl<'n, 'f> NtfsAttributeListNonResidentAttributeValue<'n, 'f> { ntfs, initial_attribute_list_entries: attribute_list_entries, connected_entries, + data_size, attribute_state: None, stream_state: StreamState::new(data_size), } @@ -62,7 +65,7 @@ impl<'n, 'f> NtfsAttributeListNonResidentAttributeValue<'n, 'f> { } pub fn len(&self) -> u64 { - self.stream_state.data_size() + self.data_size } /// Returns whether we got another data run. -- cgit v1.2.3