Source: wmctrl
Version: 1.07+git20240228.1105759-1
Severity: normal
Tags: patch, upstream
wmctrl crashes with a segmentation fault when listing information about X11 
window that does not have the WM_CLIENT_MACHINE property.

The crash occurs in display_window(), which calls strlen() on the value 
returned by get_property(). When WM_CLIENT_MACHINE is absent, get_property() 
returns NULL, resulting in strlen(NULL).

The issue can be reproduced as follows:

$ wmctrl -l
0x00800008 -1 N/A tint2
0x0100000e  0 x86 linux@x86: ~
The first window does not have WM_CLIENT_MACHINE and crashes when information 
is requested:
$ wmctrl -i -p 0x00800008 -L
Segmentation fault

Whereas a window with WM_CLIENT_MACHINE works correctly:
$ wmctrl -i -r 0x0100000e -L
0x0100000e  0 x86 linux@x86: ~

Please consider applying the attached patch, which checks for NULL before 
calling strlen().


Attachment: 0001-wmctrl-fix-null-WM_CLIENT_MACHINE.patch
Description: 0001-wmctrl-fix-null-WM_CLIENT_MACHINE.patch

Reply via email to