From 4f74c15afe53aa3cd7bf88f7be07179f5391cafe Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 16 Jan 2022 06:02:40 +0100 Subject: [PATCH] Make sure MAX_OSPATH has sane size; fix some typos --- neo/framework/Common.cpp | 2 +- neo/framework/FileSystem.h | 5 ++++- neo/sys/platform.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index 25637641..ed519650 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -2592,7 +2592,7 @@ void idCommonLocal::Async( void ) { ================= idCommonLocal::LoadGameDLLbyName -Helper for LoadGameDLL() to make it less painfull to try different dll names. +Helper for LoadGameDLL() to make it less painful to try different dll names. ================= */ void idCommonLocal::LoadGameDLLbyName( const char *dll, idStr& s ) { diff --git a/neo/framework/FileSystem.h b/neo/framework/FileSystem.h index ad1a8de2..6857fb89 100644 --- a/neo/framework/FileSystem.h +++ b/neo/framework/FileSystem.h @@ -61,7 +61,10 @@ If you have questions concerning this license or the applicable additional terms // => change it (to -1?) or does that break anything? static const ID_TIME_T FILE_NOT_FOUND_TIMESTAMP = 0xFFFFFFFF; static const int MAX_PURE_PAKS = 128; -static const int MAX_OSPATH = FILENAME_MAX; +// DG: https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html says +// that FILENAME_MAX can be *really* big on some systems and thus is not suitable +// for buffer lengths. So limit it to prevent stack overflow/out of memory issues +static const int MAX_OSPATH = (FILENAME_MAX < 32000) ? FILENAME_MAX : 32000; // modes for OpenFileByMode. used as bit mask internally typedef enum { diff --git a/neo/sys/platform.h b/neo/sys/platform.h index ac27a08e..e4ae34ce 100644 --- a/neo/sys/platform.h +++ b/neo/sys/platform.h @@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== */ -// Win32 +// AROS #if defined(__AROS__) #define _alloca alloca