Security fixes in rcore_desktop_win32.c

This commit is contained in:
M374LX 2026-05-29 19:53:07 -03:00
parent 7b96144716
commit 11bb3da0f7

View File

@ -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());