From 221181f713d17dcae262c3ebd960c3bda945899c Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 25 Jul 2024 07:38:33 +0200 Subject: [PATCH] [locale,x11] add proper checks for atom --- libfreerdp/locale/keyboard_x11.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libfreerdp/locale/keyboard_x11.c b/libfreerdp/locale/keyboard_x11.c index 3f3f574a5..471178082 100644 --- a/libfreerdp/locale/keyboard_x11.c +++ b/libfreerdp/locale/keyboard_x11.c @@ -83,20 +83,19 @@ static DWORD kbd_layout_id_from_x_property(Display* display, Window root, char* char* layout = NULL; char* variant = NULL; char* rule = NULL; - Atom property = None; Atom type = None; int item_size = 0; unsigned long items = 0; unsigned long unread_items = 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, &items, &unread_items, (unsigned char**)&rule) != Success) - { return 0; - } if (type != XA_STRING || item_size != 8 || unread_items != 0) {