From 1b57a899e81b7cdc37ce03b275f28672764e02bb Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 5 Mar 2021 01:16:14 +0000 Subject: [PATCH] Objects: Encode strings as bytes when writing --- volatility3/framework/objects/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/volatility3/framework/objects/__init__.py b/volatility3/framework/objects/__init__.py index 05679af7f..cebdc27c7 100644 --- a/volatility3/framework/objects/__init__.py +++ b/volatility3/framework/objects/__init__.py @@ -56,6 +56,8 @@ def convert_value_to_data(value: TUnion[int, float, bytes, str, bool], struct_ty raise ValueError("Invalid float size") struct_format = ("<" if data_format.byteorder == 'little' else ">") + float_vals[data_format.length] elif struct_type in [bytes, str]: + if isinstance(value, str): + value = bytes(value, 'latin-1') struct_format = str(data_format.length) + "s" else: raise TypeError("Cannot construct struct format for type {}".format(type(struct_type)))