From 906ba502c9c7237e5f23dfd0809f63b47bef6afc Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Tue, 12 Jul 2022 10:37:02 +0200 Subject: [PATCH] ams_mitm: fix logic error when truncating pairing database on read --- .../ams_mitm/source/set_mitm/setsys_mitm_service.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp index b4e5e816f..6517a3759 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp @@ -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. */