Fix the truncation of strings

MHL kindly pointed out that the string wasn't truncating, and it turns
out I misread the struct documentation, which truncates or pads with
\x00s to ensure the appropriate length.  We now truncate to the first
null we find.
This commit is contained in:
Mike Auty
2016-12-13 20:41:09 +00:00
parent a32c7e27a9
commit 2c02df125a
+2 -1
View File
@@ -140,7 +140,8 @@ class String(PrimitiveObject, str):
layer_name = object_info.layer_name,
offset = object_info.offset),
**params)
# We don't truncate on "\x00" because the string decoder does that for us
if value.find('\x00') >= 0:
value = value[:value.find('\x00')]
return value