From bef6b8472edcfcad832959ece87e2653f1840ef1 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 1 Jan 2022 16:51:34 -0300 Subject: [PATCH] Fix extraneous characters after Dell Phoenix version --- biostools/analyzers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/biostools/analyzers.py b/biostools/analyzers.py index c5e9f70..daacf42 100644 --- a/biostools/analyzers.py +++ b/biostools/analyzers.py @@ -1642,7 +1642,7 @@ class PhoenixAnalyzer(Analyzer): offset = file_data.find(b'BCPSYS') if offset > -1: # Extract the build date and time as a string. - self.string = file_data[offset + 15:offset + 32].replace(b'\x00', b'\x20').decode('ascii', 'ignore').strip() + self.string = util.read_string(file_data[offset + 15:offset + 32].replace(b'\x00', b'\x20')) # Discard if this is an invalid date/time (PHLASH.EXE) if not self._bcpsys_datetime_pattern.match(self.string): @@ -1657,8 +1657,9 @@ class PhoenixAnalyzer(Analyzer): self.signon = '\n' # Extract Dell version. - if file_data[offset + 0x20:offset + 0x21] == b'A': - self.signon += 'BIOS Version: ' + file_data[offset + 0x20:offset + 0x30].decode('ascii', 'ignore').rstrip('^\x00') + dell_version = util.read_string(file_data[offset + 0x20:offset + 0x23]) + if dell_version[0:1] == 'A': + self.signon += 'BIOS Version: ' + dell_version else: # Extract sign-on from Core and some 4.0 Release 6.0 BIOSes. match = self._core_signon_pattern.search(file_data) @@ -1933,7 +1934,7 @@ class PhoenixAnalyzer(Analyzer): if match.group(1): # the single captured character is a flag self.signon = match.group(2) + self.signon[linebreak_index:] else: - self.signon = self.signon[:linebreak_index + 1] + 'BIOS Version: ' + match.group(2) + self.signon = self.signon[:linebreak_index + 1] + 'BIOS Version: ' + match.group(2)[:3] return True