From 21291430b40ab004ad6fd69565cca143956e8c29 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 10 Jul 2021 14:17:42 -0400 Subject: [PATCH] Bug fix for stack overrun in lua-engine on mac OSX. --- src/lua-engine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index aa5f9604..d6d823fe 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -559,7 +559,7 @@ static int emu_getdir(lua_State *L) { return 1; #elif __linux__ char exePath[ 2048 ]; - ssize_t count = ::readlink( "/proc/self/exe", exePath, sizeof(exePath)-1 ); + ssize_t count = ::readlink( "/proc/self/exe", exePath, sizeof(exePath)-1 ); if ( count > 0 ) { @@ -584,7 +584,7 @@ static int emu_getdir(lua_State *L) { if ( result == 0 ) { char *dir; - exePath[ bufSize ] = 0; + exePath[ sizeof(exePath)-1 ] = 0; //printf("EXE Path: '%s' \n", exePath ); dir = ::dirname( exePath );