Skip to content

Commit

Permalink
fix for partly uninitialized sound sync packets (audioreactive)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
softhack007 committed Oct 8, 2023
1 parent 71abd11 commit 9ff7f56
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions usermods/audioreactive/audio_reactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,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;
Expand Down

0 comments on commit 9ff7f56

Please sign in to comment.