From 8cbfb96141d7b168b03be2c4d55393802f8cedf6 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Wed, 23 Apr 2025 14:40:26 -0400 Subject: [PATCH] TMS: Fix Termination / Overflow Issue; #287 --- src/dmr_pdu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/dmr_pdu.c b/src/dmr_pdu.c index 668f9f7..57b7a40 100644 --- a/src/dmr_pdu.c +++ b/src/dmr_pdu.c @@ -40,16 +40,13 @@ void utf16_to_text (dsd_state * state, uint8_t wr, uint16_t len, uint8_t * input fprintf (stderr, " / "); else fprintf (stderr, "-"); - //TODO: Add TMS String to ncurses string w/ wide char support? - //for now, just rip the first 40 or so chars lower byte value - //in the ASCII Range (should be alright for a quick visual) - char c[2]; c[0] = (char)input[i+1]; c[2] = 0; - if (wr == 1 && i < 76 && input[i+1] < 0x7F && input[i+1] >= 0x20) + //convert to ascii range (will break eastern langauge, but can't do much about that right now) + char c[2]; c[0] = (char)input[i+1]; c[1] = 0; + if (wr == 1 && i < 76 && input[i] == 0 && input[i+1] < 0x7F && input[i+1] >= 0x20) strcat (state->dmr_lrrp_gps[slot], c); //this is the long version, complete message for logging purposes - if (wr == 1 && input[i+1] < 0x7F && input[i+1] >= 0x20) - // if (wr == 1) + if (wr == 1 && input[i] == 0 && input[i+1] < 0x7F && input[i+1] >= 0x20) strcat (state->event_history_s[slot].Event_History_Items[0].text_message, c); }