mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-31 20:29:46 +02:00
Linux: Improve lengths for name_as_str
This commit is contained in:
@@ -9,14 +9,15 @@ from typing import Generator, Iterable, Iterator, Optional, Tuple
|
||||
from volatility.framework import constants
|
||||
from volatility.framework import exceptions, objects, interfaces, symbols
|
||||
from volatility.framework.layers import linear
|
||||
from volatility.framework.symbols import generic, linux
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.symbols import generic, linux
|
||||
from volatility.framework.symbols import intermed
|
||||
from volatility.framework.symbols.linux import extensions
|
||||
from volatility.framework.symbols.linux.extensions import elf
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Keep these in a basic module, to prevent import cycles when symbol providers require them
|
||||
|
||||
|
||||
@@ -154,10 +155,10 @@ class module(generic.GenericIntelProcess):
|
||||
|
||||
@property
|
||||
def section_strtab(self):
|
||||
#Newer kernels
|
||||
# Newer kernels
|
||||
if self.has_member("kallsyms"):
|
||||
return self.kallsyms.strtab
|
||||
#Older kernels
|
||||
# Older kernels
|
||||
elif self.has_member("strtab"):
|
||||
strtab = self.strtab
|
||||
|
||||
@@ -363,13 +364,13 @@ class qstr(objects.StructType):
|
||||
|
||||
def name_as_str(self) -> str:
|
||||
if self.has_member("len"):
|
||||
str_length = self.len
|
||||
str_length = self.len + 1 # Maximum length should include null terminator
|
||||
else:
|
||||
str_length = 255
|
||||
|
||||
try:
|
||||
ret = objects.utility.pointer_to_string(self.name, str_length)
|
||||
except exceptions.InvalidAddressException:
|
||||
except (exceptions.InvalidAddressException, ValueError):
|
||||
ret = ""
|
||||
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user