summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-07 15:39:56 +0200
committerGitHub <noreply@github.com>2019-07-07 15:39:56 +0200
commit1fad6c0eed398b1dd594dcf43cbc4013be7c396e (patch)
treec2b57bf6195884a494a6e83dbd8fa20ebb96b018 /modules/luci-base/luasrc
parente13822e7096056ead944d1b7b3ff64864d80ccb5 (diff)
parentf73da9ca82ff8e0352c3942ea78ab7d1d0317668 (diff)
Merge pull request #2806 from dibdot/magic
system-wide: fix escaping of magic chars
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/cbi/datatypes.lua2
-rw-r--r--modules/luci-base/luasrc/util.lua5
2 files changed, 3 insertions, 4 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua
index 33d018d2d..c1cf01f9c 100644
--- a/modules/luci-base/luasrc/cbi/datatypes.lua
+++ b/modules/luci-base/luasrc/cbi/datatypes.lua
@@ -418,7 +418,7 @@ function maxlength(val, max)
end
function phonedigit(val)
- return (val:match("^[0-9\*#!%.]+$") ~= nil)
+ return (val:match("^[0-9%*#!%.]+$") ~= nil)
end
function timehhmmss(val)
diff --git a/modules/luci-base/luasrc/util.lua b/modules/luci-base/luasrc/util.lua
index 1a329f3f2..a30e8b72f 100644
--- a/modules/luci-base/luasrc/util.lua
+++ b/modules/luci-base/luasrc/util.lua
@@ -207,9 +207,8 @@ end
-- handling. It may actually be a property of the getopt function
-- rather than the shell proper.
function shellstartsqescape(value)
- res, _ = string.gsub(value, "^\-", "\\-")
- res, _ = string.gsub(res, "^-", "\-")
- return shellsqescape(value)
+ res, _ = string.gsub(value, "^%-", "\\-")
+ return shellsqescape(res)
end
-- containing the resulting substrings. The optional max parameter specifies