GameNetworkingSockets
GameNetworkingSockets copied to clipboard
fix: Integer Overflow or Wraparound on Multiplication result converted to larger type
Ticket 🎟️ #363
fix the problem, we need to ensure that the multiplication is performed using a larger integer type to avoid overflow. This can be achieved by casting one of the operands to size_t before performing the multiplication. This way, the multiplication will be done using the size_t type, which is typically larger than unsigned int and can hold larger values.
The specific change involves modifying the multiplication expression on line 21 to cast m_nAllocationCount to size_t before multiplying it by m_unSizeOfElements.