From 9f537bcb37f1f2a352a90e44fe9c91710da009fb Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Sun, 21 Feb 2010 00:58:07 +0100 Subject: [PATCH] awful.menu: sanitize support for access keys Commit 87070ca introduced support for access keys in menus. Chosen character was "&", an XML entity that has potential to cause problems; if a user tries to add multiple access keys or just put an ampersand in the name of the item the menu will break. Breaking happened because ampersands were not escaped - first one was substituted and the rest were ignored, but not escaped which triggered a pango markup error. Signed-off-by: Adrian C. (anrxc) Signed-off-by: Julien Danjou --- lib/awful/menu.lua.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index ade0a12f..9df7fb07 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -208,10 +208,11 @@ local function add_item(data, num, item_info) -- Create the item label widget local label = widget({ type = "textbox" }) local key = '' - label.text = string.gsub(item_info[1], "&(%w)", function (l) - key= string.lower(l) - return ""..l.."" - end, 1) + label.text = string.gsub(util.escape(item_info[1]), "&(%w)", + function (l) + key = string.lower(l) + return ""..l.."" + end, 1) -- Set icon if needed local iconbox if item_info[3] then