Merge pull request #26096 from Faless/net/enet_id_check

Add check to validate client IDs in ENet.
This commit is contained in:
Rémi Verschelde 2019-02-20 17:49:12 +01:00 committed by GitHub
commit 643af210b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,6 +231,13 @@ void NetworkedMultiplayerENet::poll() {
break;
}
// A client joined with an invalid ID (neagtive values, 0, and 1 are reserved).
// Probably trying to exploit us.
if (server && ((int)event.data < 2 || peer_map.has((int)event.data))) {
enet_peer_reset(event.peer);
ERR_CONTINUE(true);
}
int *new_id = memnew(int);
*new_id = event.data;