2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

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
This commit is contained in:
Jarrod Johnson 2017-04-19 09:36:14 -04:00
parent b9b9620a9d
commit a20566f8e2

View File

@ -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