linux-capture: Fix potential null pointer dereference

Use dstr_cmp() instead of strcmp() to prevent null pointer dereferences.

This code for this source has way too many pointers.
This commit is contained in:
Lain
2024-10-05 13:46:34 -07:00
parent 089ba29961
commit 5a1fca9347

View File

@@ -310,7 +310,7 @@ xcb_window_t xcomp_find_window(xcb_connection_t *conn, Display *disp, const char
struct dstr cwname = xcomp_window_name(conn, disp, cwin);
struct dstr cwcls = xcomp_window_class(conn, cwin);
bool found = strcmp(wname, cwname.array) == 0 && strcmp(wcls, cwcls.array) == 0;
bool found = dstr_cmp(&cwname, wname) == 0 && dstr_cmp(&cwcls, wcls) == 0;
dstr_free(&cwname);
dstr_free(&cwcls);