From ef3bab610d28783f6468885e9dd9fbac500074aa Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 15 Aug 2023 17:47:03 +0100 Subject: [PATCH] CIrrDeviceLinux: Fix type for NET_WM_PID XChangeProperty This uses format=32 which in X11's API means a C type of long (with restricted range when > 32 bits). pid_t is of unknown type, though on Linux and FreeBSD it's a 32-bit type, so does not have the same size as long on 64-bit architectures, and thus XChangeProperty reads outside its bounds. Fix this by casting to and passing a long. --- source/Irrlicht/CIrrDeviceLinux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index 9d4033b5..dae3b04e 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/source/Irrlicht/CIrrDeviceLinux.cpp @@ -332,7 +332,7 @@ void CIrrDeviceLinux::setupTopLevelXorgWindow() Atom NET_WM_PID = XInternAtom(XDisplay, "_NET_WM_PID", false); - pid_t pid = getpid(); + long pid = static_cast(getpid()); XChangeProperty(XDisplay, XWindow, NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,