From 640452c18bbe15bfea4763883bcbc277317f1b6f Mon Sep 17 00:00:00 2001 From: schellingb <14200249+schellingb@users.noreply.github.com> Date: Wed, 15 May 2024 22:27:19 +0900 Subject: [PATCH] Fix crash when using REMOUNT command on drive beyond D: --- dosbox_pure_libretro.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dosbox_pure_libretro.cpp b/dosbox_pure_libretro.cpp index 8abc662c..b3ccff8c 100644 --- a/dosbox_pure_libretro.cpp +++ b/dosbox_pure_libretro.cpp @@ -959,8 +959,9 @@ static void DBP_Remount(char drive1, char drive2) else { // Swap registration with BIOS/CMOS - if (imageDisk*& dsk = imageDiskList[drive1-'A']) + if (drive1 < 'A'+MAX_DISK_IMAGES && imageDiskList[drive1-'A']) { + imageDisk*& dsk = imageDiskList[drive1-'A']; if (drive2 < 'A'+MAX_DISK_IMAGES) imageDiskList[drive2-'A'] = dsk; else if (!dynamic_cast(Drives[drive1-'A'])) delete dsk; dsk = NULL;