From f8cdd28cc83deab6353645d232f031a6c1542543 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 3 Feb 2023 12:14:28 +0000 Subject: [PATCH] sanitize input to the picker --- src/screencast/wlr_screencast.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index 1c22e78..10d895f 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -40,6 +40,9 @@ void handleTitle(void *data, struct zwlr_foreign_toplevel_handle_v1 *handle, con wl_list_for_each(current, &ctx->toplevel_resource_list, link) { if (current->handle == handle) { strncpy(current->name, title, 255); + for (int i = 0; i < 255; ++i) + if (current->name[i] == '\"' || current->name[i] == '\011' || current->name[i] == '\'') + current->name[i] = ' '; current->name[255] = '\0'; break; } @@ -53,6 +56,9 @@ void handleAppID(void *data, struct zwlr_foreign_toplevel_handle_v1 *handle, con wl_list_for_each(current, &ctx->toplevel_resource_list, link) { if (current->handle == handle) { strncpy(current->clazz, app_id, 255); + for (int i = 0; i < 255; ++i) + if (current->clazz[i] == '\"' || current->clazz[i] == '\011' || current->clazz[i] == '\'') + current->clazz[i] = ' '; current->name[255] = '\0'; break; }