ams_mitm: fix logic error when truncating pairing database on read

This commit is contained in:
ndeadly 2022-07-12 10:37:02 +02:00
parent 74f551f090
commit 906ba502c9

View file

@ -114,11 +114,11 @@ namespace ams::mitm::settings {
u64 db_offset = sizeof(total_entries);
if (total_entries > db_max_size) {
/* Cap number of database entries read to size of database on this firmware. */
total_entries = db_max_size;
/* Pairings are stored from least to most recent. Add offset to skip the older entries that won't fit. */
db_offset += (total_entries - db_max_size) * sizeof(settings::BluetoothDevicesSettings);
/* Cap number of database entries read to size of database on this firmware. */
total_entries = db_max_size;
}
/* Read database entries. */