@@ -294,6 +294,7 @@ static void reliable_text_freedv_callback_rx(void *state, char chr)
294294 char decodedStr [RELIABLE_TEXT_MAX_RAW_LENGTH + 1 ];
295295 char rawStr [RELIABLE_TEXT_MAX_RAW_LENGTH + 1 ];
296296 memset (rawStr , 0 , RELIABLE_TEXT_MAX_RAW_LENGTH + 1 );
297+ memset (decodedStr , 0 , RELIABLE_TEXT_MAX_RAW_LENGTH + 1 );
297298
298299 if (reliable_text_ldpc_decode (obj , rawStr ) != 0 )
299300 {
@@ -304,7 +305,7 @@ static void reliable_text_freedv_callback_rx(void *state, char chr)
304305 // Get expected and actual CRC.
305306 unsigned char receivedCRC = decodedStr [0 ];
306307 unsigned char calcCRC = calculateCRC8_ (& rawStr [RELIABLE_TEXT_CRC_LENGTH ], RELIABLE_TEXT_MAX_LENGTH );
307-
308+
308309 //fprintf(stderr, "rxCRC: %d, calcCRC: %d, decodedStr: %s\n", receivedCRC, calcCRC, &decodedStr[RELIABLE_TEXT_CRC_LENGTH]);
309310 if (receivedCRC == calcCRC )
310311 {
@@ -318,6 +319,7 @@ static void reliable_text_freedv_callback_rx(void *state, char chr)
318319 obj -> sym_index = 0 ;
319320 memset (& obj -> inbound_pending_syms , 0 , sizeof (complex float )* LDPC_TOTAL_SIZE_BITS /2 );
320321 memset (& obj -> inbound_pending_amps , 0 , sizeof (float )* LDPC_TOTAL_SIZE_BITS /2 );
322+ memset (& obj -> inbound_pending_bits , 0 , LDPC_TOTAL_SIZE_BITS + RELIABLE_TEXT_UW_LENGTH_BITS );
321323 }
322324 else
323325 {
@@ -395,8 +397,9 @@ void reliable_text_set_string(reliable_text_t ptr, const char* str, int strlengt
395397 assert (impl != NULL );
396398
397399 char tmp [RELIABLE_TEXT_MAX_RAW_LENGTH + 1 ];
400+ memset (tmp , 0 , RELIABLE_TEXT_MAX_RAW_LENGTH + 1 );
398401
399- convert_callsign_to_ota_string_ (str , & tmp [RELIABLE_TEXT_CRC_LENGTH ], strlength < RELIABLE_TEXT_MAX_LENGTH ? strlength : RELIABLE_TEXT_MAX_LENGTH );
402+ convert_callsign_to_ota_string_ (str , & tmp [RELIABLE_TEXT_CRC_LENGTH ], strlength < RELIABLE_TEXT_MAX_LENGTH ? strlength : RELIABLE_TEXT_MAX_LENGTH );
400403
401404 int txt_length = strlen (& tmp [RELIABLE_TEXT_CRC_LENGTH ]);
402405 if (txt_length >= RELIABLE_TEXT_MAX_LENGTH )
@@ -407,7 +410,7 @@ void reliable_text_set_string(reliable_text_t ptr, const char* str, int strlengt
407410 impl -> tx_text_index = 0 ;
408411 unsigned char crc = calculateCRC8_ (& tmp [RELIABLE_TEXT_CRC_LENGTH ], txt_length );
409412 tmp [0 ] = crc ;
410-
413+
411414 // Encode block of text using LDPC(112,56).
412415 unsigned char ibits [LDPC_TOTAL_SIZE_BITS / 2 ];
413416 unsigned char pbits [LDPC_TOTAL_SIZE_BITS / 2 ];
0 commit comments