Skip to content

Commit

Permalink
Amend the heap overflow fixes
Browse files Browse the repository at this point in the history
GameConfig will need a bit of a rework but that doesn't belong in this branch, we've bloated it too much already.
  • Loading branch information
xen-000 committed Feb 19, 2024
1 parent 6f05dcc commit ec9cc36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/gameconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ int CGameConfig::HexStringToUint8Array(const char* hexString, uint8_t* byteArray
}
}

byteArray[byteCount] = '\0'; // Add a null-terminating character.

return byteCount; // Return the number of bytes successfully converted.
}

Expand All @@ -258,7 +256,7 @@ byte *CGameConfig::HexToByte(const char *src, size_t &length)
}

length = strlen(src) / 4;
uint8_t *dest = new uint8_t[length + 1];
uint8_t *dest = new uint8_t[length];
int byteCount = HexStringToUint8Array(src, dest, length);
if (byteCount <= 0)
{
Expand Down
3 changes: 2 additions & 1 deletion src/utils/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class CModule
for (size_t i = 0; i < m_size; i++)
{
size_t Matches = 0;
while (Matches < iSigLength && *(pMemory + i + Matches) == pData[Matches] || pData[Matches] == '\x2A')
while (*(pMemory + i + Matches) == pData[Matches] || pData[Matches] == '\x2A')
{
Matches++;
if (Matches == iSigLength)
Expand All @@ -87,6 +87,7 @@ class CModule
}

return_addr = (void *)(pMemory + i);
break;
}
}
}
Expand Down

0 comments on commit ec9cc36

Please sign in to comment.