From a20566f8e2f34fc4b6621ca3876c18d9b7c488b9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 19 Apr 2017 09:36:14 -0400 Subject: [PATCH] Abort MAC decode from FRU if not 'binary' If the TLV says the mac data is text, then it's not going to be a good day. Abort in such a case. Change-Id: I597df429de9af516aa28868d90f31984fa2923e2 --- pyghmi/ipmi/oem/lenovo/handler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 7591578f..16513bff 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -464,6 +464,10 @@ class OEMHandler(generic.OEMHandler): macprefix = None while idx < endidx: currmac = macs[idx:idx+6] + if not isinstance(currmac, bytearray): + # invalid vpd format, abort attempts to extract + # mac in this way + break if currmac == b'\x00\x00\x00\x00\x00\x00': break # VPD may veer off, detect and break off