aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-12-19 01:00:55 +0100
committerStapleButter <thetotalworm@gmail.com>2017-12-19 01:00:55 +0100
commit9336e15197694eeb823da785668c5d892c318db4 (patch)
treefa8ca6dcdde743e1fe9ba8d584b897e3a0860a4b
parent5fe30d306fee644754f4f2f70142136ca6aa16a5 (diff)
avoid crashing when receiving a packet that is too large
-rw-r--r--src/libui_sdl/Platform.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libui_sdl/Platform.cpp b/src/libui_sdl/Platform.cpp
index f84f8f4..507e0f3 100644
--- a/src/libui_sdl/Platform.cpp
+++ b/src/libui_sdl/Platform.cpp
@@ -410,6 +410,8 @@ void LAN_RXCallback(u_char* blarg, const struct pcap_pkthdr* header, const u_cha
{
while (PCapRXNum > 0);
+ if (header->len > 2048-64) return;
+
PCapPacketLen = header->len;
memcpy(PCapPacketBuffer, data, PCapPacketLen);
PCapRXNum = 1;