From c4f42d6e596da8d284a0d89d12002e7d8ca62a68 Mon Sep 17 00:00:00 2001 From: Justin Wai Date: Thu, 18 Jul 2024 18:52:04 +0800 Subject: [PATCH] Avoid copying to output string if tag item is not AT3 type --- AT3/AT3Tags.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AT3/AT3Tags.cpp b/AT3/AT3Tags.cpp index 20d719e5..79fefeb9 100644 --- a/AT3/AT3Tags.cpp +++ b/AT3/AT3Tags.cpp @@ -170,6 +170,8 @@ void AT3Tags::OnGetTagItem(CFlightPlan FlightPlan, CRadarTarget RadarTarget, int return; } + bool isAT3Item = true; + *pColorCode = TAG_COLOR_RGB_DEFINED; switch (FlightPlan.GetState()) { case FLIGHT_PLAN_STATE_NON_CONCERNED: @@ -245,10 +247,13 @@ void AT3Tags::OnGetTagItem(CFlightPlan FlightPlan, CRadarTarget RadarTarget, int break; default: tagOutput = ""; + isAT3Item = false; } // Convert string output to character array - strcpy_s(sItemString, 16, tagOutput.substr(0, 15).c_str()); + if (isAT3Item) { + strcpy_s(sItemString, 16, tagOutput.substr(0, 15).c_str()); + } } void AT3Tags::OnTimer(int Counter) {