mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-07 18:27:39 +02:00
use ATTRIBUTE_NAME_MAX_SIZE constant
This commit is contained in:
@@ -3172,7 +3172,9 @@ class module_sect_attr(objects.StructType):
|
||||
"""
|
||||
if hasattr(self, "battr"):
|
||||
try:
|
||||
return utility.pointer_to_string(self.battr.attr.name, count=32)
|
||||
return utility.pointer_to_string(
|
||||
self.battr.attr.name, count=linux_constants.ATTRIBUTE_NAME_MAX_SIZE
|
||||
)
|
||||
except exceptions.InvalidAddressException:
|
||||
# if battr is present then its name attribute needs to be valid
|
||||
vollog.debug(f"Invalid battr name for section at {self.vol.offset:#x}")
|
||||
@@ -3180,14 +3182,18 @@ class module_sect_attr(objects.StructType):
|
||||
|
||||
elif self.name.vol.type_name == "array":
|
||||
try:
|
||||
return utility.array_to_string(self.name, count=32)
|
||||
return utility.array_to_string(
|
||||
self.name, count=linux_constants.ATTRIBUTE_NAME_MAX_SIZE
|
||||
)
|
||||
except exceptions.InvalidAddressException:
|
||||
# specifically do not return here to give `mattr` a chance
|
||||
vollog.debug(f"Invalid direct name for section at {self.vol.offset:#x}")
|
||||
|
||||
elif self.name.vol.type_name == "pointer":
|
||||
try:
|
||||
return utility.pointer_to_string(self.name, count=32)
|
||||
return utility.pointer_to_string(
|
||||
self.name, count=linux_constants.ATTRIBUTE_NAME_MAX_SIZE
|
||||
)
|
||||
except exceptions.InvalidAddressException:
|
||||
# specifically do not return here to give `mattr` a chance
|
||||
vollog.debug(
|
||||
@@ -3197,7 +3203,9 @@ class module_sect_attr(objects.StructType):
|
||||
# if everything else failed...
|
||||
if hasattr(self, "mattr"):
|
||||
try:
|
||||
return utility.pointer_to_string(self.mattr.attr.name, count=32)
|
||||
return utility.pointer_to_string(
|
||||
self.mattr.attr.name, count=linux_constants.ATTRIBUTE_NAME_MAX_SIZE
|
||||
)
|
||||
except exceptions.InvalidAddressException:
|
||||
vollog.debug(
|
||||
f"Unresolvable name for for section at {self.vol.offset:#x}"
|
||||
@@ -3213,7 +3221,9 @@ class bin_attribute(objects.StructType):
|
||||
"""
|
||||
if hasattr(self, "attr"):
|
||||
try:
|
||||
return utility.pointer_to_string(self.attr.name, count=32)
|
||||
return utility.pointer_to_string(
|
||||
self.attr.name, count=linux_constants.ATTRIBUTE_NAME_MAX_SIZE
|
||||
)
|
||||
except exceptions.InvalidAddressException:
|
||||
vollog.debug(
|
||||
f"Invalid attr name for bin_attribute at {self.vol.offset:#x}"
|
||||
|
||||
Reference in New Issue
Block a user