Linux: update extensions used by kallsyms plugin to use utility.pointer_to_string

This commit is contained in:
eve
2025-04-25 16:40:06 +01:00
parent b5c98a080a
commit 2d1acaca51
@@ -3065,14 +3065,7 @@ class kernel_symbol(objects.StructType):
else:
raise AttributeError("Unsupported kernel_symbol type implementation")
layer = self._context.layers[self.vol.layer_name]
name_bytes = layer.read(name_offset, linux_constants.KSYM_NAME_LEN)
idx = name_bytes.find(b"\x00")
if idx != -1:
name_bytes = name_bytes[:idx]
return name_bytes.decode("utf-8", errors="ignore")
return utility.pointer_to_string(name_offset, linux_constants.KSYM_NAME_LEN)
def get_name(self) -> Optional[str]:
try:
@@ -3108,14 +3101,9 @@ class kernel_symbol(objects.StructType):
else:
raise AttributeError("Unsupported kernel_symbol type implementation")
layer = self._context.layers[self.vol.layer_name]
namespace_bytes = layer.read(namespace_offset, linux_constants.KSYM_NAME_LEN)
idx = namespace_bytes.find(b"\x00")
if idx != -1:
namespace_bytes = namespace_bytes[:idx]
return namespace_bytes.decode("utf-8", errors="ignore")
return utility.pointer_to_string(
namespace_offset, linux_constants.KSYM_NAME_LEN
)
def get_namespace(self) -> Optional[str]:
try: