example: use snprintf

This commit is contained in:
Matthias Ringwald 2022-05-23 15:07:12 +02:00
parent f89e874b33
commit db2353e526
2 changed files with 3 additions and 3 deletions

View File

@ -94,8 +94,8 @@ static uint16_t pbap_cid;
static int sim1_selected;
static void refresh_phonebook_folder_and_path(void){
sprintf(phonebook_path, "%s%s.vcf", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook_name);
sprintf(phonebook_folder, "%s%s", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook_name);
snprintf(phonebook_path, sizeof(phonebook_path), "%s%s.vcf", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook_name);
snprintf(phonebook_folder, sizeof(phonebook_folder), "%s%s", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook_name);
printf("[-] Phonebook folder '%s'\n", phonebook_folder);
printf("[-] Phonebook path '%s'\n", phonebook_path);
}

View File

@ -220,7 +220,7 @@ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle,
static void beat(void){
counter++;
counter_string_len = sprintf(counter_string, "BTstack counter %04u", counter);
counter_string_len = snprintf(counter_string, sizeof(counter_string), "BTstack counter %04u", counter);
puts(counter_string);
}