[locale,x11] add proper checks for atom

This commit is contained in:
akallabeth 2024-07-25 07:38:33 +02:00
parent 56b50966a3
commit 221181f713
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -83,20 +83,19 @@ static DWORD kbd_layout_id_from_x_property(Display* display, Window root, char*
char* layout = NULL; char* layout = NULL;
char* variant = NULL; char* variant = NULL;
char* rule = NULL; char* rule = NULL;
Atom property = None;
Atom type = None; Atom type = None;
int item_size = 0; int item_size = 0;
unsigned long items = 0; unsigned long items = 0;
unsigned long unread_items = 0; unsigned long unread_items = 0;
DWORD layout_id = 0; DWORD layout_id = 0;
property = XInternAtom(display, property_name, False); Atom property = XInternAtom(display, property_name, False);
if (property == None)
return 0;
if (XGetWindowProperty(display, root, property, 0, 1024, False, XA_STRING, &type, &item_size, if (XGetWindowProperty(display, root, property, 0, 1024, False, XA_STRING, &type, &item_size,
&items, &unread_items, (unsigned char**)&rule) != Success) &items, &unread_items, (unsigned char**)&rule) != Success)
{
return 0; return 0;
}
if (type != XA_STRING || item_size != 8 || unread_items != 0) if (type != XA_STRING || item_size != 8 || unread_items != 0)
{ {