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.
This commit is contained in:
Jessica Clarke 2023-08-15 17:47:03 +01:00 committed by sfan5
parent d98dc90b38
commit ef3bab610d
1 changed files with 1 additions and 1 deletions

View File

@ -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<long>(getpid());
XChangeProperty(XDisplay, XWindow, NET_WM_PID,
XA_CARDINAL, 32, PropModeReplace,