From 967afa0d783ff9625caf1b069e3cd1246836b09f Mon Sep 17 00:00:00 2001 From: CyberGreg05 <62875146+CyberGreg05@users.noreply.github.com> Date: Tue, 19 Mar 2024 00:51:23 +0300 Subject: [PATCH] Fix incorrect comparison when counting smbios tables (#271) +Fix incorrect comparison. Table counting may have completed early due to an incorrect comparison. +refacto. --- al-khaser/AntiVM/Generic.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/al-khaser/AntiVM/Generic.cpp b/al-khaser/AntiVM/Generic.cpp index 8848908..fb9937d 100755 --- a/al-khaser/AntiVM/Generic.cpp +++ b/al-khaser/AntiVM/Generic.cpp @@ -1978,11 +1978,11 @@ BOOL handle_one_table(BYTE* currentPosition, UINT& bias, BYTE* smBiosTableBounda return TRUE; } - currentPosition += tableHeader->length * sizeof(BYTE); + currentPosition += tableHeader->length; UINT i = 0; // Find the end of the table while (!(currentPosition[i] == 0 && currentPosition[i + 1] == 0) - && (currentPosition[i + 1] < smBiosTableBoundary[0])) + && (currentPosition + i + 1 < smBiosTableBoundary)) { i++; } @@ -2017,7 +2017,7 @@ BOOL check_tables_number(const PBYTE smbios) { break; } - currentPosition += biasNewTable * sizeof(BYTE); + currentPosition += biasNewTable; } const UINT tableMinReal = 40;