mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-27 12:04:50 +02:00
Objects: Encode strings as bytes when writing
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user