22# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
33#
44
5+ from typing import Optional
6+
57from volatility3 .framework import objects , constants , exceptions
68
79
@@ -26,7 +28,15 @@ def get_full_name(self) -> str:
2628class MFTAttribute (objects .StructType ):
2729 """This represents an MFT ATTRIBUTE"""
2830
29- def get_resident_filename (self ) -> str :
31+ def get_resident_filename (self ) -> Optional [str ]:
32+ # 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
33+ # Length as 512 as its 256*2, which is the maximum size for an entire file path, so this is even generous
34+ if (
35+ self .Attr_Header .ContentOffset > 0x400000
36+ or self .Attr_Header .NameLength > 512
37+ ):
38+ return None
39+
3040 # To get the resident name, we jump to relative name offset and read name length * 2 bytes of data
3141 try :
3242 name = self ._context .object (
@@ -41,7 +51,15 @@ def get_resident_filename(self) -> str:
4151 except exceptions .InvalidAddressException :
4252 return None
4353
44- def get_resident_filecontent (self ) -> bytes :
54+ def get_resident_filecontent (self ) -> Optional [bytes ]:
55+ # smear observed in mass testing of samples
56+ # 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
57+ if (
58+ self .Attr_Header .ContentOffset > 0x400000
59+ or self .Attr_Header .ContentLength > 0x400000
60+ ):
61+ return None
62+
4563 # To get the resident content, we jump to relative content offset and read name length * 2 bytes of data
4664 try :
4765 bytesobj = self ._context .object (
0 commit comments