From 9038c5165d22fe69fbbf6392361b0155fd0c6484 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 4 Jan 2010 23:37:16 +0100 Subject: [PATCH] awful.wibox: sanitize height/width args to function new() When both height and width arguments are provided to the function new() there is a check to see if one of them was a screen percentage, and is expected to be a string. If the user provided absolute pixels, and argument is of type number awesome will crash. Now tostring is used to sanitize the arguments during this check. Signed-off-by: Adrian C. (anrxc) Signed-off-by: Julien Danjou --- lib/awful/wibox.lua.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/awful/wibox.lua.in b/lib/awful/wibox.lua.in index 7341c4bd2..3d32e8c47 100644 --- a/lib/awful/wibox.lua.in +++ b/lib/awful/wibox.lua.in @@ -13,6 +13,7 @@ local capi = client = client } local setmetatable = setmetatable +local tostring = tostring local ipairs = ipairs local table = table local type = type @@ -226,7 +227,7 @@ function new(arg) if arg.height then has_to_stretch = false if arg.screen then - local hp = arg.height:match("(%d+)%%") + local hp = tostring(arg.height):match("(%d+)%%") if hp then arg.height = capi.screen[arg.screen].geometry.height * hp / 100 end @@ -237,7 +238,7 @@ function new(arg) if arg.width then has_to_stretch = false if arg.screen then - local wp = arg.width:match("(%d+)%%") + local wp = tostring(arg.width):match("(%d+)%%") if wp then arg.width = capi.screen[arg.screen].geometry.width * wp / 100 end