mirror of
https://github.com/godotengine/godot.git
synced 2025-01-18 20:40:57 +08:00
Merge pull request #26096 from Faless/net/enet_id_check
Add check to validate client IDs in ENet.
This commit is contained in:
commit
643af210b1
@ -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…
Reference in New Issue
Block a user