From 7ed4e828852c174d8c8e482ccd56c9504002f1b7 Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Thu, 11 Feb 2010 11:43:36 +0100 Subject: [PATCH] bugfix: global tools: catch invalid location in command line Signed-off-by: Gordon Hecker --- generic/e2lib.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 7aede66..3faeb8f 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1766,15 +1766,18 @@ end function parse_server_location(arg, default_server) local sl = {} sl.server, sl.location = arg:match("(%S+):(%S+)") - if sl.server and sl.location then - return sl - end - sl.location = arg:match("(%S+)") - if sl.location and default_server then + if not (sl.server and sl.location) then + sl.location = arg:match("(%S+)") + if not (sl.location and default_server) then + return nil, "can't parse location" + end sl.server = default_server - return sl end - return nil, "can't parse location" + if sl.location:match("[.][.]") or + sl.location:match("^/") then + return nil, "invalid location" + end + return sl end --- setup cache from the global server configuration -- 2.39.5