From 93439700f1bf31f0f469734de8fb7e3d017df128 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Fri, 6 Dec 2024 12:35:47 +0000 Subject: [PATCH 1/3] Update osd.c --- src/main/io/osd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 953588e6f4d..c6f507824b9 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5346,12 +5346,12 @@ static void osdShowHDArmScreen(void) armScreenRow = drawLogos(false, armScreenRow); armScreenRow++; - if (!osdConfig()->use_pilot_logo && osdElementEnabled(OSD_PILOT_NAME, false) && strlen(systemConfig()->pilotName) > 0) { + if (!osdConfig()->use_pilot_logo && strlen(systemConfig()->pilotName) > 0) { osdFormatPilotName(buf2); showPilotOrCraftName = true; } - if (osdElementEnabled(OSD_CRAFT_NAME, false) && strlen(systemConfig()->craftName) > 0) { + if (strlen(systemConfig()->craftName) > 0) { osdFormatCraftName(craftNameBuf); if (strlen(buf2) > 0) { strcat(buf2, " : "); From 5de70141e14bac6ce9887b9163a8b5126ad32a10 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Fri, 6 Dec 2024 12:40:36 +0000 Subject: [PATCH 2/3] Oops. I forgot analogue --- src/main/io/osd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index c6f507824b9..b016d72692b 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5486,12 +5486,12 @@ static void osdShowSDArmScreen(void) #endif #endif - if (osdElementEnabled(OSD_PILOT_NAME, false) && strlen(systemConfig()->pilotName) > 0) { + if (strlen(systemConfig()->pilotName) > 0) { osdFormatPilotName(buf2); showPilotOrCraftName = true; } - if (osdElementEnabled(OSD_CRAFT_NAME, false) && strlen(systemConfig()->craftName) > 0) { + if (strlen(systemConfig()->craftName) > 0) { osdFormatCraftName(craftNameBuf); if (strlen(buf2) > 0) { strcat(buf2, " : "); From 823e8ee792b9576199acc0f8a007b8af1e4dfba4 Mon Sep 17 00:00:00 2001 From: Mr D - RC Date: Sat, 7 Dec 2024 17:04:19 +0000 Subject: [PATCH 3/3] Fix random characters buf2 and craftNameBuf were not initialised. But, could have been used. Both are now initialised before use. Initialises buf2 and craftNameBuf before use. buf2 is used for pilot name. craftNameBuf is used for craft name. Both, pilot but no craft name, and vice versa would have caused the error on the unused name. --- src/main/io/osd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index b016d72692b..77e5f8a583b 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5346,11 +5346,13 @@ static void osdShowHDArmScreen(void) armScreenRow = drawLogos(false, armScreenRow); armScreenRow++; + memset(buf2, '\0', sizeof(buf2)); if (!osdConfig()->use_pilot_logo && strlen(systemConfig()->pilotName) > 0) { osdFormatPilotName(buf2); showPilotOrCraftName = true; } + memset(craftNameBuf, '\0', sizeof(craftNameBuf)); if (strlen(systemConfig()->craftName) > 0) { osdFormatCraftName(craftNameBuf); if (strlen(buf2) > 0) { @@ -5486,11 +5488,13 @@ static void osdShowSDArmScreen(void) #endif #endif + memset(buf2, '\0', sizeof(buf2)); if (strlen(systemConfig()->pilotName) > 0) { osdFormatPilotName(buf2); showPilotOrCraftName = true; } + memset(craftNameBuf, '\0', sizeof(craftNameBuf)); if (strlen(systemConfig()->craftName) > 0) { osdFormatCraftName(craftNameBuf); if (strlen(buf2) > 0) {