From ea32c97b82cd532aca6cbc538f821643a33daed9 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Thu, 11 Jan 2024 20:24:59 +0100 Subject: [PATCH] Fix for #3672 --- wled00/udp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wled00/udp.cpp b/wled00/udp.cpp index c8bd0cd9e..65c35882b 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -612,13 +612,13 @@ void handleNotifications() if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return; uint16_t totalLen = strip.getLengthTotal(); - if (udpIn[0] == 1) //warls + if (udpIn[0] == 1 && packetSize > 5) //warls { for (size_t i = 2; i < packetSize -3; i += 4) { setRealtimePixel(udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3], 0); } - } else if (udpIn[0] == 2) //drgb + } else if (udpIn[0] == 2 && packetSize > 4) //drgb { uint16_t id = 0; for (size_t i = 2; i < packetSize -2; i += 3) @@ -627,7 +627,7 @@ void handleNotifications() id++; if (id >= totalLen) break; } - } else if (udpIn[0] == 3) //drgbw + } else if (udpIn[0] == 3 && packetSize > 6) //drgbw { uint16_t id = 0; for (size_t i = 2; i < packetSize -3; i += 4) @@ -636,7 +636,7 @@ void handleNotifications() id++; if (id >= totalLen) break; } - } else if (udpIn[0] == 4) //dnrgb + } else if (udpIn[0] == 4 && packetSize > 7) //dnrgb { uint16_t id = ((udpIn[3] << 0) & 0xFF) + ((udpIn[2] << 8) & 0xFF00); for (size_t i = 4; i < packetSize -2; i += 3) @@ -645,7 +645,7 @@ void handleNotifications() setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], 0); id++; } - } else if (udpIn[0] == 5) //dnrgbw + } else if (udpIn[0] == 5 && packetSize > 8) //dnrgbw { uint16_t id = ((udpIn[3] << 0) & 0xFF) + ((udpIn[2] << 8) & 0xFF00); for (size_t i = 4; i < packetSize -2; i += 4)