aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/collision/Maps/MapTree.cpp3
-rw-r--r--src/server/game/Server/WorldSession.cpp26
-rw-r--r--src/server/shared/Packets/ByteBuffer.h5
3 files changed, 30 insertions, 4 deletions
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index bb57079c389..d592d795125 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -157,8 +157,7 @@ namespace VMAP
{
float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe
- if (maxDist == std::numeric_limits<float>::max() ||
- maxDist == std::numeric_limits<float>::infinity())
+ if (maxDist == std::numeric_limits<float>::max() || !std::isfinite(maxDist))
return false;
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 850aecbf164..81d33d30a35 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -1340,6 +1340,17 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
}
case CMSG_MESSAGECHAT:
+ {
+ maxPacketCounterAllowed = 50;
+ break;
+ }
+
+ case CMSG_CONTACT_LIST:
+ {
+ maxPacketCounterAllowed = 10;
+ break;
+ }
+
case CMSG_WHO:
case CMSG_GAMEOBJ_USE:
case CMSG_GAMEOBJ_REPORT_USE:
@@ -1352,7 +1363,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
case CMSG_REQUEST_VEHICLE_NEXT_SEAT:
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
case CMSG_TOGGLE_PVP:
- case CMSG_CONTACT_LIST:
case CMSG_ADD_FRIEND:
case CMSG_DEL_FRIEND:
case CMSG_SET_CONTACT_NOTES:
@@ -1479,9 +1489,21 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
break;
}
+ case CMSG_SET_ACTION_BUTTON:
+ {
+ maxPacketCounterAllowed = MAX_ACTION_BUTTONS;
+ break;
+ }
+
+ case CMSG_ITEM_REFUND_INFO:
+ {
+ maxPacketCounterAllowed = PLAYER_SLOTS_COUNT;
+ break;
+ }
+
default:
{
- maxPacketCounterAllowed = 30;
+ maxPacketCounterAllowed = 100;
break;
}
}
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index dd0a9d5fdf4..9f766a72d19 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -31,6 +31,7 @@
#include <vector>
#include <cstring>
#include <time.h>
+#include <math.h>
// Root of ByteBuffer exception hierarchy
class ByteBufferException : public std::exception
@@ -241,12 +242,16 @@ class ByteBuffer
ByteBuffer &operator>>(float &value)
{
value = read<float>();
+ if (!std::isfinite(value))
+ throw ByteBufferException();
return *this;
}
ByteBuffer &operator>>(double &value)
{
value = read<double>();
+ if (!std::isfinite(value))
+ throw ByteBufferException();
return *this;
}