From 2e266ec945b1e51b22f8668a7d31b32184b58776 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 13 Jul 2024 09:55:59 +0200 Subject: [PATCH] use fixes-size stack buffer ... protected against array overflow due to previous "if (packetSize <= UDPSOUND_MAX_PACKET)" --- usermods/audioreactive/audio_reactive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index fe946db9b..088ac880b 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1095,7 +1095,7 @@ class AudioReactive : public Usermod { #endif if ((packetSize > 5) && (packetSize <= UDPSOUND_MAX_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); // VERIFY THAT THIS IS A COMPATIBLE PACKET