Skip to content

Commit 306b7ff

Browse files
committed
use maxsize argument
1 parent 1571e65 commit 306b7ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

volatility3/framework/plugins/regexscan.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
4949
def _generator(self, regex_pattern):
5050
regex_pattern = bytes(regex_pattern, "UTF-8")
5151
vollog.debug(f"RegEx Pattern: {regex_pattern}")
52-
52+
maxsize = self.config.get("maxsize", self.MAXSIZE_DEFAULT)
5353
layer = self.context.layers[self.config["primary"]]
5454
for offset in layer.scan(
5555
context=self.context, scanner=scanners.RegExScanner(regex_pattern)
5656
):
57-
result_data = layer.read(offset, self.MAXSIZE_DEFAULT, pad=True)
57+
result_data = layer.read(offset, maxsize, pad=True)
5858

5959
# reapply the regex in order to extract just the match
6060
regex_result = re.match(regex_pattern, result_data)
6161

6262
if regex_result:
63-
# the match is within the results_data (e.g. it fits within MAXSIZE_DEFAULT)
63+
# the match is within the results_data (e.g. it fits within maxsize)
6464
# extract just the match itself
6565
regex_match = regex_result.group(0)
6666
text_result = str(regex_match, encoding="UTF-8", errors="replace")
6767
bytes_result = regex_match
6868
else:
69-
# the match is not with the results_data (e.g. it doesn't fit within MAXSIZE_DEFAULT)
69+
# the match is not with the results_data (e.g. it doesn't fit within maxsize)
7070
text_result = str(result_data, encoding="UTF-8", errors="replace")
7171
bytes_result = result_data
7272

0 commit comments

Comments
 (0)