From 11bb3da0f7409d187df0ae7e966a48b052495982 Mon Sep 17 00:00:00 2001 From: M374LX Date: Fri, 29 May 2026 19:53:07 -0300 Subject: [PATCH] Security fixes in rcore_desktop_win32.c --- src/platforms/rcore_desktop_win32.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platforms/rcore_desktop_win32.c b/src/platforms/rcore_desktop_win32.c index a797234ba..e55c2d8ac 100644 --- a/src/platforms/rcore_desktop_win32.c +++ b/src/platforms/rcore_desktop_win32.c @@ -1258,7 +1258,7 @@ void OpenURL(const char *url) else { char *cmd = (char *)RL_CALLOC(strlen(url) + 32, sizeof(char)); - sprintf(cmd, "explorer \"%s\"", url); + snprintf(cmd, strlen(url) + 32, "explorer \"%s\"", url); int result = system(cmd); if (result == -1) TRACELOG(LOG_WARNING, "OpenURL() child process could not be created"); RL_FREE(cmd); @@ -2052,8 +2052,11 @@ static void HandleMouseButton(int button, char state) static void HandleRawInput(LPARAM lparam) { RAWINPUT input = { 0 }; + UINT inputSize = 0; + + if (GetRawInputData((HRAWINPUT)lparam, RID_INPUT, NULL, &inputSize, sizeof(RAWINPUTHEADER)) != 0) return; + if (inputSize > sizeof(input)) return; - UINT inputSize = sizeof(input); UINT size = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &input, &inputSize, sizeof(RAWINPUTHEADER)); if (size == (UINT)-1) TRACELOG(LOG_ERROR, "WIN32: Failed to get raw input data [ERROR: %lu]", GetLastError());