From 5a1fca9347fdfd5ed00212e3069382cbb832dca0 Mon Sep 17 00:00:00 2001 From: Lain Date: Sat, 5 Oct 2024 13:46:34 -0700 Subject: [PATCH] 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. --- plugins/linux-capture/xcomposite-input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/linux-capture/xcomposite-input.c b/plugins/linux-capture/xcomposite-input.c index a040bf62f..0e86fe443 100644 --- a/plugins/linux-capture/xcomposite-input.c +++ b/plugins/linux-capture/xcomposite-input.c @@ -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);