summaryrefslogtreecommitdiff
path: root/modules/enet
diff options
context:
space:
mode:
Diffstat (limited to 'modules/enet')
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index c9a7d96ae7..c1bec533dd 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1">
+<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.2">
<brief_description>
PacketPeer implementation using the ENet library.
</brief_description>
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index e53846e269..000917507a 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;
@@ -426,7 +433,6 @@ bool NetworkedMultiplayerENet::is_server() const {
void NetworkedMultiplayerENet::close_connection(uint32_t wait_usec) {
ERR_FAIL_COND(!active);
- ERR_FAIL_COND(wait_usec < 0);
_pop_current_packet();