diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-02-20 17:49:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-20 17:49:12 +0100 |
commit | 643af210b1b96b17b33f9bdb8d6921b18145ea47 (patch) | |
tree | 3d40181f85e71235d79c6f2f28ff6842a9f0049e /modules | |
parent | 5023cc111b96cea6cb8164bf56b6de75d656b75d (diff) | |
parent | dc583a6225faf5aa8e4a2891f559cc391d619fc8 (diff) |
Merge pull request #26096 from Faless/net/enet_id_check
Add check to validate client IDs in ENet.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/enet/networked_multiplayer_enet.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index e53846e269..871c33bb35 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -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; |