From 736e14c83e2f8930a64d2f77a65113cf4d031449 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 10 Jul 2018 21:49:38 -0400 Subject: [PATCH] Ensures no buffer overrun when installing the OS ROM. --- Machines/Electron/Electron.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 08af2995b..304ce1c30 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -486,7 +486,7 @@ class ConcreteMachine: case ROM::ADFS1: adfs1_ = data; return; case ROM::ADFS2: adfs2_ = data; return; - case ROM::OS: target = os_; break; + case ROM::OS: target = os_; return; default: target = roms_[static_cast(slot)]; rom_write_masks_[static_cast(slot)] = is_writeable; @@ -500,7 +500,9 @@ class ConcreteMachine: std::memcpy(&target[rom_ptr], data.data(), size_to_copy); rom_ptr += size_to_copy; } - rom_inserted_[static_cast(slot)] = true; + + if(static_cast(slot) < 16) + rom_inserted_[static_cast(slot)] = true; } // MARK: - Work deferral updates.