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)