mirror of
https://github.com/godotengine/godot.git
synced 2025-04-25 01:48:08 +08:00
Add check to validate client IDs in ENet.
Server now checks that the ID received from the client is not already used by someone else and is a valid ID (>=2)
This commit is contained in:
parent
d39c0577c0
commit
dc583a6225
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user