From 051cb009dff7458f143b359f02274a164b5f5169 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 4 Jan 2024 14:59:44 -0600 Subject: [PATCH] lsteamclient: Fix g_tmppath buffer length. CW-Bug-Id: #23197 --- lsteamclient/gen_wrapper.py | 2 +- lsteamclient/steamclient_main.c | 2 +- lsteamclient/unixlib.h | 2 ++ lsteamclient/unixlib_generated.cpp | 32 +++++++++++++++--------------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index 43b05838..4c73c173 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -561,7 +561,7 @@ class Struct: if field.name not in path_conv_fields: out(f' ret.{field.name} = this->{field.name};\n') else: - out(f' steamclient_unix_path_to_dos_path(1, this->{field.name}, g_tmppath, sizeof(g_tmppath), 1);\n') + out(f' steamclient_unix_path_to_dos_path(1, this->{field.name}, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1);\n') out(f' ret.{field.name} = g_tmppath;\n') out(u' return ret;\n') out(u'}\n') diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index 8aa58288..1ba10f90 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -45,7 +45,7 @@ DEFINE_VTBL_WRAPPER(56); #endif -static char temp_path_buffer[PATH_MAX]; +static char temp_path_buffer[TEMP_PATH_BUFFER_LENGTH]; static CRITICAL_SECTION steamclient_cs = { NULL, -1, 0, 0, 0, 0 }; static HANDLE steam_overlay_event; diff --git a/lsteamclient/unixlib.h b/lsteamclient/unixlib.h index 1044f85a..d6c25639 100644 --- a/lsteamclient/unixlib.h +++ b/lsteamclient/unixlib.h @@ -12,6 +12,8 @@ #include "steamclient_structs.h" +#define TEMP_PATH_BUFFER_LENGTH 4096 + #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/unixlib_generated.cpp b/lsteamclient/unixlib_generated.cpp index b0a2274c..991749c7 100644 --- a/lsteamclient/unixlib_generated.cpp +++ b/lsteamclient/unixlib_generated.cpp @@ -10260,7 +10260,7 @@ u64_HTML_FileOpenDialog_t::operator w64_HTML_FileOpenDialog_t() const w64_HTML_FileOpenDialog_t ret; ret.unBrowserHandle = this->unBrowserHandle; ret.pchTitle = this->pchTitle; - steamclient_unix_path_to_dos_path(1, this->pchInitialFile, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchInitialFile, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchInitialFile = g_tmppath; return ret; } @@ -10281,7 +10281,7 @@ u32_HTML_FileOpenDialog_t::operator w32_HTML_FileOpenDialog_t() const w32_HTML_FileOpenDialog_t ret; ret.unBrowserHandle = this->unBrowserHandle; ret.pchTitle = this->pchTitle; - steamclient_unix_path_to_dos_path(1, this->pchInitialFile, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchInitialFile, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchInitialFile = g_tmppath; return ret; } @@ -10333,7 +10333,7 @@ u64_HTML_FinishedRequest_t::operator w64_HTML_FinishedRequest_t() const { w64_HTML_FinishedRequest_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchPageTitle = this->pchPageTitle; return ret; @@ -10354,7 +10354,7 @@ u32_HTML_FinishedRequest_t::operator w32_HTML_FinishedRequest_t() const { w32_HTML_FinishedRequest_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchPageTitle = this->pchPageTitle; return ret; @@ -10520,7 +10520,7 @@ u64_HTML_LinkAtPosition_t::operator w64_HTML_LinkAtPosition_t() const ret.unBrowserHandle = this->unBrowserHandle; ret.x = this->x; ret.y = this->y; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.bInput = this->bInput; ret.bLiveLink = this->bLiveLink; @@ -10547,7 +10547,7 @@ u32_HTML_LinkAtPosition_t::operator w32_HTML_LinkAtPosition_t() const ret.unBrowserHandle = this->unBrowserHandle; ret.x = this->x; ret.y = this->y; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.bInput = this->bInput; ret.bLiveLink = this->bLiveLink; @@ -10835,7 +10835,7 @@ u64_HTML_NewWindow_t_132x::operator w64_HTML_NewWindow_t_132x() const { w64_HTML_NewWindow_t_132x ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.unX = this->unX; ret.unY = this->unY; @@ -10864,7 +10864,7 @@ u32_HTML_NewWindow_t_132x::operator w32_HTML_NewWindow_t_132x() const { w32_HTML_NewWindow_t_132x ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.unX = this->unX; ret.unY = this->unY; @@ -10892,7 +10892,7 @@ u64_HTML_NewWindow_t_130x::operator w64_HTML_NewWindow_t_130x() const { w64_HTML_NewWindow_t_130x ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.unX = this->unX; ret.unY = this->unY; @@ -10919,7 +10919,7 @@ u32_HTML_NewWindow_t_130x::operator w32_HTML_NewWindow_t_130x() const { w32_HTML_NewWindow_t_130x ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.unX = this->unX; ret.unY = this->unY; @@ -10966,7 +10966,7 @@ u64_HTML_OpenLinkInNewTab_t::operator w64_HTML_OpenLinkInNewTab_t() const { w64_HTML_OpenLinkInNewTab_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; return ret; } @@ -10985,7 +10985,7 @@ u32_HTML_OpenLinkInNewTab_t::operator w32_HTML_OpenLinkInNewTab_t() const { w32_HTML_OpenLinkInNewTab_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; return ret; } @@ -11097,7 +11097,7 @@ u64_HTML_StartRequest_t::operator w64_HTML_StartRequest_t() const { w64_HTML_StartRequest_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchTarget = this->pchTarget; ret.pchPostData = this->pchPostData; @@ -11122,7 +11122,7 @@ u32_HTML_StartRequest_t::operator w32_HTML_StartRequest_t() const { w32_HTML_StartRequest_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchTarget = this->pchTarget; ret.pchPostData = this->pchPostData; @@ -11246,7 +11246,7 @@ u64_HTML_URLChanged_t::operator w64_HTML_URLChanged_t() const { w64_HTML_URLChanged_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchPostData = this->pchPostData; ret.bIsRedirect = this->bIsRedirect; @@ -11273,7 +11273,7 @@ u32_HTML_URLChanged_t::operator w32_HTML_URLChanged_t() const { w32_HTML_URLChanged_t ret; ret.unBrowserHandle = this->unBrowserHandle; - steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, sizeof(g_tmppath), 1); + steamclient_unix_path_to_dos_path(1, this->pchURL, g_tmppath, TEMP_PATH_BUFFER_LENGTH, 1); ret.pchURL = g_tmppath; ret.pchPostData = this->pchPostData; ret.bIsRedirect = this->bIsRedirect;