mirror of
https://github.com/wled/WLED.git
synced 2025-07-23 10:46:33 +00:00
use fixes-size stack buffer
... protected against array overflow due to previous "if (packetSize <= UDPSOUND_MAX_PACKET)"
This commit is contained in:
parent
3a8e19d1b4
commit
2e266ec945
@ -1095,7 +1095,7 @@ class AudioReactive : public Usermod {
|
|||||||
#endif
|
#endif
|
||||||
if ((packetSize > 5) && (packetSize <= UDPSOUND_MAX_PACKET)) {
|
if ((packetSize > 5) && (packetSize <= UDPSOUND_MAX_PACKET)) {
|
||||||
//DEBUGSR_PRINTLN("Received UDP Sync Packet");
|
//DEBUGSR_PRINTLN("Received UDP Sync Packet");
|
||||||
static uint8_t fftBuff[UDPSOUND_MAX_PACKET+1] = { 0 }; // static buffer for receiving, to reuse the same memory and avoid heap fragmentation
|
uint8_t fftBuff[UDPSOUND_MAX_PACKET+1] = { 0 }; // fixed-size buffer for receiving (stack), to avoid heap fragmentation caused by variable sized arrays
|
||||||
fftUdp.read(fftBuff, packetSize);
|
fftUdp.read(fftBuff, packetSize);
|
||||||
|
|
||||||
// VERIFY THAT THIS IS A COMPATIBLE PACKET
|
// VERIFY THAT THIS IS A COMPATIBLE PACKET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user