From ccfcde35557e2dc6204272682b14ff259e310365 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Apr 2008 13:22:58 +0200 Subject: [PATCH] [client] Escape clients name Signed-off-by: Julien Danjou --- client.c | 9 +++++++-- structs.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index fd9966d4..22ec4c39 100644 --- a/client.c +++ b/client.c @@ -188,12 +188,17 @@ client_get_byname(client_t *list, char *name) void client_updatetitle(client_t *c) { + char buf[512]; + if(!xutil_gettextprop(globalconf.connection, c->win, xutil_intern_atom(globalconf.connection, "_NET_WM_NAME"), - c->name, sizeof(c->name))) + buf, sizeof(buf))) xutil_gettextprop(globalconf.connection, c->win, xutil_intern_atom(globalconf.connection, "WM_NAME"), - c->name, sizeof(c->name)); + buf, sizeof(buf)); + if(c->name) + p_delete(&c->name); + c->name = g_markup_escape_text(buf, -1); titlebar_draw(c); widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); } diff --git a/structs.h b/structs.h index b1985ddb..983c70eb 100644 --- a/structs.h +++ b/structs.h @@ -186,7 +186,7 @@ typedef struct client_t client_t; struct client_t { /** Client name */ - char name[256]; + char *name; /** Window geometry */ area_t geometry; /** Floating window geometry */