From ed487bd55c4697fe1a44a9f41f52efcc3d84987c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 30 Nov 2023 11:12:25 -0300 Subject: [PATCH] bios_extract: Skip Phoenix module chain on older versions without the appropriate BCPSYS field --- bios_extract/src/phoenix.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bios_extract/src/phoenix.c b/bios_extract/src/phoenix.c index 4240d34..c93739d 100644 --- a/bios_extract/src/phoenix.c +++ b/bios_extract/src/phoenix.c @@ -1001,17 +1001,19 @@ PhoenixExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset, phx.commonCharacterLZSS = ' '; } - Offset = le32toh(*((uint32_t *) (((char *)SYS) + 0x77))); - Offset &= (BIOSLength - 1); - if (!Offset) { - fprintf(stderr, "BCPSYS module offset is NULL.\n"); - if (FFV) - PhoenixFFV(BIOSImage, BIOSLength, FFV); - } + if (SYS->Length >= 0x7b) { + Offset = le32toh(*((uint32_t *) (((char *)SYS) + 0x77))); + Offset &= (BIOSLength - 1); + if (!Offset) { + fprintf(stderr, "BCPSYS module offset is NULL.\n"); + if (FFV) + PhoenixFFV(BIOSImage, BIOSLength, FFV); + } - while (Offset) { - Offset = PhoenixModule(BIOSImage, BIOSLength, Offset); - Offset &= BIOSLength - 1; + while (Offset) { + Offset = PhoenixModule(BIOSImage, BIOSLength, Offset); + Offset &= BIOSLength - 1; + } } /* All scans below based on phoedeco */