2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 15:53:32 +00:00

Remove null bytes within a string

Null bytes have been observed within strings, remove them to
avoid the binary data in the output.

Change-Id: I651038c45ec346e66b4026c28c72499af8f378df
This commit is contained in:
Jarrod Johnson
2021-04-14 08:31:57 -04:00
parent b4fd80d530
commit 19931598a2

View File

@@ -229,6 +229,7 @@ class FRU(object):
# Additionally 0xfe has been observed, which should be a thorn, but
# again assuming termination of string is more likely than thorn.
retinfo = retinfo.rstrip(b'\xfe\xff\x10\x03\x00 ')
retinfo = retinfo.replace(b'\x00', b'')
if lang in (0, 25):
try:
retinfo = retinfo.decode('iso-8859-1')