twhl-community / halflife-updated

Half-Life SDK updated to compile under VS2019 and 2022. Check README.md for more information.
Other
382 stars 146 forks source link

Entities with an index greater than 2047 corrupt the client's heap if sent over the network #191

Closed SamVanheer closed 1 year ago

SamVanheer commented 1 year ago

If an entity with an index greater than 2047 is sent over the network the client's heap may be corrupted because the index is sent using only 11 bits (2^11 == 2048). Essentially the index is sent over as index % 2048. If the entity in the resulting index is not in use then the heap can be corrupted due to invalid access.

To prevent this the server should refuse to send entities with an index that would cause such a problem.