@@ -231,7 +231,7 @@ bool check_output_index_state() {
231231}
232232
233233void inplace_selection_sort (size_t len , uint8_t * list ) {
234- size_t i , j , position ;
234+ size_t i = 0 , j = 0 , position = 0 ;
235235 uint8_t tmp ;
236236 for (i = 0 ; i < (len - 1 ); i ++ ) {
237237 position = i ;
@@ -252,7 +252,7 @@ bool skip_change_outputs() {
252252 return false;
253253 }
254254 // confirmed outputs holds the true current output index
255- uint8_t change_indices [1 + TX_MAX_TOKENS ];
255+ uint8_t change_indices [1 + TX_MAX_TOKENS ] = { 0 } ;
256256 for (uint8_t i = 0 ; i < G_context .tx_info .change_len ; i ++ ) {
257257 change_indices [i ] = G_context .tx_info .change_info [i ].index ;
258258 }
@@ -318,15 +318,15 @@ bool prepare_display_output() {
318318
319319 // token_index == 0 means HTR, else use token_index-1 as index on the tokens array
320320 if (token_index == 0 ) {
321- strcpy (symbol , "HTR" );
321+ strlcpy (symbol , "HTR" , 4 );
322322 symbol_len = 3 ;
323323 } else {
324324 // custom token
325325 token_symbol_t * token = G_context .tx_info .tokens [token_index - 1 ];
326- strcpy (symbol , token -> symbol );
326+ strlcpy (symbol , token -> symbol , MAX_TOKEN_SYMBOL_LEN + 1 );
327327 symbol_len = strlen (token -> symbol );
328328 }
329- strcpy (g_amount , symbol );
329+ strlcpy (g_amount , symbol , 30 );
330330 g_amount [symbol_len ] = ' ' ;
331331 format_value (output .value , g_amount + symbol_len + 1 );
332332 return false;
0 commit comments