From cedb1e0c7e263ad5960c1c05e0b4d8f5dfdc28b7 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 11 Oct 2025 07:49:14 +1000 Subject: [PATCH] fix(radio): unaligned access in Ghost tool (#6638) --- radio/src/pulses/ghost.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/radio/src/pulses/ghost.cpp b/radio/src/pulses/ghost.cpp index e06d49743..9dd3fc656 100644 --- a/radio/src/pulses/ghost.cpp +++ b/radio/src/pulses/ghost.cpp @@ -44,6 +44,7 @@ static uint8_t getGhostModuleAddr() static uint8_t createGhostMenuControlFrame(uint8_t * frame, int16_t * pulses) { uint8_t * buf = frame; + memset(buf, 0, GHST_UL_RC_CHANS_SIZE + 2); *buf++ = getGhostModuleAddr(); // addr *buf++ = GHST_UL_RC_CHANS_SIZE; // length @@ -53,9 +54,9 @@ static uint8_t createGhostMenuControlFrame(uint8_t * frame, int16_t * pulses) // payload *buf++ = reusableBuffer.ghostMenu.buttonAction; // Joystick states, Up, Down, Left, Right, Press *buf++ = reusableBuffer.ghostMenu.menuAction; // menu control, open, close, etc. - for (uint8_t i = 0; i < 8; i++) { - *buf++ = 0; // padding to make this the same size as the pulses packet - } + + // skip padding + buf += 8; // crc *buf++ = crc8(crc_start, GHST_UL_RC_CHANS_SIZE - 1);