Merge pull request #1664 from volatilityfoundation/fix_psaux_env_decode

Correctly use decode with replace to avoid backtraces on partially sm…
This commit is contained in:
ikelos
2025-03-05 23:42:12 +00:00
committed by GitHub
2 changed files with 4 additions and 2 deletions
@@ -95,7 +95,9 @@ class Envars(plugins.PluginInterface):
envar_data = envar_data.rstrip(b"\x00")
for envar_pair in envar_data.split(b"\x00"):
try:
env_key, env_value = envar_pair.decode().split("=", 1)
env_key, env_value = envar_pair.decode(
encoding="utf8", errors="replace"
).split("=", 1)
except ValueError:
# Some legitimate programs, like 'avahi-daemon', avoid reallocating the args
# and instead exploit the fact that the environment variables area is contiguous
+1 -1
View File
@@ -78,7 +78,7 @@ class PsAux(plugins.PluginInterface):
return renderers.UnreadableValue()
# the arguments are null byte terminated, replace the nulls with spaces
s = argv.decode().split("\x00")
s = argv.decode(encoding="utf8", errors="replace").split("\x00")
args = " ".join(s)
else:
# kernel thread