mirror of
https://github.com/godotengine/godot.git
synced 2025-01-23 19:12:24 -05: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
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue