From: Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
Date: Sat, 3 Feb 2024 12:36:04 +0100
Subject: Fix invalid string buffer access

closes #3
---
 src/kc/memory.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/kc/memory.cc b/src/kc/memory.cc
index faae11a..edaf2e3 100644
--- a/src/kc/memory.cc
+++ b/src/kc/memory.cc
@@ -366,9 +366,7 @@ Memory::load_rom(const char *key, void *buf)
   string rompath; // must be still in scope when calling load_rom() below...
   if (!sys_isabsolutepath(romfile))
     {
-      string datadir(kcemu_datadir);
-      string romdir = datadir + system->get_rom_directory() + "/";
-      rompath = romdir + romfile;
+      rompath = string(kcemu_datadir) + system->get_rom_directory() + "/" + romfile;
       romfile = rompath.c_str();
       DBG(1, form("KCemu/Memory/load_rom",
                   "Memory::load_rom(): resolving relative path to '%s'\n",
