@@ -95,8 +95,9 @@ int32_t nfc_playlist_emulation_task(void* context) {
95
95
int time_counter_ms = (options_emulate_timeout [nfc_playlist -> emulate_timeout ]* 1000 );
96
96
97
97
if (storage_file_exists (storage , file_path ) == false) {
98
- char popup_header_text [(18 + strlen (file_name ))];
99
- snprintf (popup_header_text , (18 + strlen (file_name )), "%s\n%s" , "ERROR not found:" , file_name );
98
+ int popup_header_text_size = strlen (file_name ) + 18 ;
99
+ char popup_header_text [popup_header_text_size ];
100
+ snprintf (popup_header_text , popup_header_text_size , "%s\n%s" , "ERROR not found:" , file_name );
100
101
popup_set_header (nfc_playlist -> popup , popup_header_text , 64 , 10 , AlignCenter , AlignTop );
101
102
start_blink (nfc_playlist , NfcPlaylistLedState_Error );
102
103
while (time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating ) {
@@ -109,8 +110,9 @@ int32_t nfc_playlist_emulation_task(void* context) {
109
110
}
110
111
111
112
else if (strcasestr (file_ext , "nfc" ) == NULL ) {
112
- char popup_header_text [(21 + strlen (file_name ))];
113
- snprintf (popup_header_text , (21 + strlen (file_name )), "%s\n%s" , "ERROR invalid file:" , file_name );
113
+ int popup_header_text_size = strlen (file_name ) + 21 ;
114
+ char popup_header_text [popup_header_text_size ];
115
+ snprintf (popup_header_text , popup_header_text_size , "%s\n%s" , "ERROR invalid file:" , file_name );
114
116
popup_set_header (nfc_playlist -> popup , popup_header_text , 64 , 10 , AlignCenter , AlignTop );
115
117
start_blink (nfc_playlist , NfcPlaylistLedState_Error );
116
118
while (time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating ) {
@@ -123,8 +125,9 @@ int32_t nfc_playlist_emulation_task(void* context) {
123
125
}
124
126
125
127
else {
126
- char popup_header_text [(12 + strlen (file_name ))];
127
- snprintf (popup_header_text , (12 + strlen (file_name )), "%s\n%s" , "Emulating:" , file_name );
128
+ int popup_header_text_size = strlen (file_name ) + 12 ;
129
+ char popup_header_text [popup_header_text_size ];
130
+ snprintf (popup_header_text , popup_header_text_size , "%s\n%s" , "Emulating:" , file_name );
128
131
popup_set_header (nfc_playlist -> popup , popup_header_text , 64 , 10 , AlignCenter , AlignTop );
129
132
nfc_playlist_worker_set_nfc_data (nfc_playlist -> nfc_playlist_worker , file_path );
130
133
nfc_playlist_worker_start (nfc_playlist -> nfc_playlist_worker );
0 commit comments