fix for partly uninitialized sound sync packets (audioreactive)

audioSyncPacket contains four "invisible" padding bytes added by the compiler. These need to be initialized to zero, as future versions of the protocol will make use of these fields.
This commit is contained in:
Frank 2023-10-08 19:54:14 +02:00 committed by GitHub
parent 74d196ad50
commit 4245767357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -960,6 +960,8 @@ class AudioReactive : public Usermod {
//DEBUGSR_PRINTLN("Transmitting UDP Mic Packet");
audioSyncPacket transmitData;
memset(reinterpret_cast<void *>(&transmitData), 0, sizeof(transmitData)); // make sure that the packet - including "invisible" padding bytes added by the compiler - is fully initialized
strncpy_P(transmitData.header, PSTR(UDP_SYNC_HEADER), 6);
// transmit samples that were not modified by limitSampleDynamics()
transmitData.sampleRaw = (soundAgc) ? rawSampleAgc: sampleRaw;