Skip to content

Commit

Permalink
Fix uninitialised buffers on arming screens
Browse files Browse the repository at this point in the history
Fixes #10506

buf2 and craftNameBuf were not initialised. But, could have been used. Both are now initialised before use.
  • Loading branch information
MrD-RC committed Dec 7, 2024
1 parent a25df70 commit 81f0e3a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5346,11 +5346,13 @@ static void osdShowHDArmScreen(void)
armScreenRow = drawLogos(false, armScreenRow);
armScreenRow++;

memset(buf2, '\0', sizeof(buf2));
if (!osdConfig()->use_pilot_logo && osdElementEnabled(OSD_PILOT_NAME, false) && strlen(systemConfig()->pilotName) > 0) {
osdFormatPilotName(buf2);
showPilotOrCraftName = true;
}

memset(craftNameBuf, '\0', sizeof(craftNameBuf));
if (osdElementEnabled(OSD_CRAFT_NAME, false) && strlen(systemConfig()->craftName) > 0) {
osdFormatCraftName(craftNameBuf);
if (strlen(buf2) > 0) {
Expand Down Expand Up @@ -5486,11 +5488,13 @@ static void osdShowSDArmScreen(void)
#endif
#endif

memset(buf2, '\0', sizeof(buf2));
if (osdElementEnabled(OSD_PILOT_NAME, false) && strlen(systemConfig()->pilotName) > 0) {
osdFormatPilotName(buf2);
showPilotOrCraftName = true;
}

memset(craftNameBuf, '\0', sizeof(craftNameBuf));
if (osdElementEnabled(OSD_CRAFT_NAME, false) && strlen(systemConfig()->craftName) > 0) {
osdFormatCraftName(craftNameBuf);
if (strlen(buf2) > 0) {
Expand Down

0 comments on commit 81f0e3a

Please sign in to comment.