From 19931598a2fda2aa177b40e2329d32f073c2ffc2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 14 Apr 2021 08:31:57 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/fru.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyghmi/ipmi/fru.py b/pyghmi/ipmi/fru.py index 0b132510..cec37ef6 100644 --- a/pyghmi/ipmi/fru.py +++ b/pyghmi/ipmi/fru.py @@ -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')