-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added: out of bounds checks for RakNet arrays #905
base: master
Are you sure you want to change the base?
Conversation
@@ -451,7 +452,9 @@ void RakNetLegacyNetwork::OnPlayerConnect(RakNet::RPCParameters* rpcParams, void | |||
|
|||
network->networkEventDispatcher.dispatch(&NetworkEventHandler::onPeerConnect, *newPeer); | |||
|
|||
network->playerRemoteSystem[newPeer->getID()] = remoteSystem; | |||
auto poolID = newPeer->getID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense to me - if a new peer was just created successfully (non null) then their ID should be valid
|
||
if (!player) | ||
{ | ||
return; | ||
} | ||
|
||
playerFromRakIndex[rid] = nullptr; | ||
playerRemoteSystem[player->getID()] = nullptr; | ||
auto poolID = player->getID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue here
@@ -361,7 +361,10 @@ class RakNetLegacyNetwork final : public Network, public CoreEventHandler, publi | |||
|
|||
unsigned getPing(const IPlayer& peer) override | |||
{ | |||
auto remoteSystem = playerRemoteSystem[peer.getID()]; | |||
auto poolID = peer.getID(); | |||
if(poolID < 0 || poolID >= PLAYER_POOL_SIZE) return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
Fixes several potential server crashes due to access array out of bounds.