From 2b3c4aeca9b6e57f02bc29e4e9dfd2548be4fe11 Mon Sep 17 00:00:00 2001 From: chaoticgd <43898262+chaoticgd@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:15:18 +0000 Subject: [PATCH] PINE: Fix stack buffer overflow for long XDG_RUNTIME_DIR paths --- pcsx2/PINE.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcsx2/PINE.cpp b/pcsx2/PINE.cpp index 6103c0a64e5da4..916737addb0beb 100644 --- a/pcsx2/PINE.cpp +++ b/pcsx2/PINE.cpp @@ -306,7 +306,8 @@ bool PINEServer::Initialize(int slot) return false; } server.sun_family = AF_UNIX; - strcpy(server.sun_path, m_socket_name.c_str()); + strncpy(server.sun_path, m_socket_name.c_str(), sizeof(server.sun_path)); + server.sun_path[sizeof(server.sun_path) - 1] = '\0'; // we unlink the socket so that when releasing this thread the socket gets // freed even if we didn't close correctly the loop