@@ -134,8 +134,14 @@ void totp_cli_command_pin_handle(PluginState* plugin_state, FuriString* args, Cl
134
134
plugin_state -> crypto_verify_data = NULL ;
135
135
}
136
136
137
- totp_crypto_seed_iv (
138
- plugin_state , new_pin_length > 0 ? & new_pin [0 ] : NULL , new_pin_length );
137
+ if (!totp_crypto_seed_iv (
138
+ plugin_state , new_pin_length > 0 ? & new_pin [0 ] : NULL , new_pin_length )) {
139
+ memset_s (& new_pin [0 ], TOTP_IV_SIZE , 0 , TOTP_IV_SIZE );
140
+ TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE ();
141
+ break ;
142
+ }
143
+
144
+ memset_s (& new_pin [0 ], TOTP_IV_SIZE , 0 , TOTP_IV_SIZE );
139
145
140
146
TOTP_LIST_FOREACH (plugin_state -> tokens_list , node , {
141
147
TokenInfo * token_info = node -> data ;
@@ -152,15 +158,18 @@ void totp_cli_command_pin_handle(PluginState* plugin_state, FuriString* args, Cl
152
158
free (plain_token );
153
159
});
154
160
155
- totp_full_save_config_file (plugin_state );
156
-
157
161
TOTP_CLI_DELETE_LAST_LINE ();
158
162
159
- if (do_change ) {
160
- TOTP_CLI_PRINTF ("PIN has been successfully changed\r\n" );
161
- } else if (do_remove ) {
162
- TOTP_CLI_PRINTF ("PIN has been successfully removed\r\n" );
163
+ if (totp_full_save_config_file (plugin_state ) == TotpConfigFileUpdateSuccess ) {
164
+ if (do_change ) {
165
+ TOTP_CLI_PRINTF ("PIN has been successfully changed\r\n" );
166
+ } else if (do_remove ) {
167
+ TOTP_CLI_PRINTF ("PIN has been successfully removed\r\n" );
168
+ }
169
+ } else {
170
+ TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE ();
163
171
}
172
+
164
173
} while (false);
165
174
166
175
if (load_generate_token_scene ) {
0 commit comments