From 6102054bb6f15d14ebaec7f7eea913b1ec40a9ae Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 18 Dec 2016 15:37:05 +0000 Subject: [PATCH] Enable string encoding and emphasize that max_length applies to bytes in memory not to number of characters in the string. --- volatility/framework/objects/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index fb2b33cdb..c9a820427 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -111,7 +111,8 @@ class Bytes(PrimitiveObject, bytes): class String(PrimitiveObject, str): """Primitive Object that handles string values - length: specifies the maximum possible length that the string could hold in memory + length: specifies the maximum possible length that the string could hold within memory + (note: for multibyte characters, this will not be the maximum length of the string) """ _struct_type = str @@ -142,7 +143,7 @@ class String(PrimitiveObject, str): **params) if value.find('\x00') >= 0: value = value[:value.find('\x00')] - return value + return str(value, encoding = encoding, errors = errors) class Pointer(Integer):