From e19ba70c7ff42565a02165c7f1fef1f9aa3d8f88 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 28 Mar 2019 14:39:12 +0100 Subject: [PATCH] Fix exception due to UDP packet memory flooding (#5540) Fix exception due to UDP packet memory flooding (#5540) --- sonoff/xplg_wemohue.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonoff/xplg_wemohue.ino b/sonoff/xplg_wemohue.ino index e3351fbe4..51e51f84b 100644 --- a/sonoff/xplg_wemohue.ino +++ b/sonoff/xplg_wemohue.ino @@ -222,7 +222,7 @@ bool UdpConnect(void) void PollUdp(void) { - if (udp_connected && !udp_response_mutex && devices_present) { + if (udp_connected) { if (PortUdp.parsePacket()) { char packet_buffer[UDP_BUFFER_SIZE]; // buffer to hold incoming UDP/SSDP packet @@ -232,7 +232,7 @@ void PollUdp(void) AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len); // AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer); - if (strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr) { + if ((strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr) && !udp_response_mutex && devices_present) { udp_response_mutex = true; udp_remote_ip = PortUdp.remoteIP();