summaryrefslogtreecommitdiffhomepage
path: root/libs/core/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-01-25 13:03:17 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-01-25 13:03:17 +0000
commitb0abe4aa08517b4bab745d3638c538c16f2fa806 (patch)
treef5edb1ae70037778f4983e9852cf1e80e67f1d41 /libs/core/luasrc
parent1179fd247780808d252fae7235a8cafe607fca94 (diff)
libs/core: further fixes for luci.util.pcdata(), fix wrong character range and drop invalid control chars entirely
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r--libs/core/luasrc/util.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua
index 03eb2f128a..79f01a6269 100644
--- a/libs/core/luasrc/util.lua
+++ b/libs/core/luasrc/util.lua
@@ -196,12 +196,13 @@ end
local function _pcdata_repl(c)
local i = string.byte(c)
- if ( i >= 0x00 and i <= 0x08 ) or
- ( i >= 0x0B and i <= 0x0C ) or
- ( i >= 0x0E and i <= 0x0F ) or
- ( i >= 0x26 and i <= 0x27 ) or
- ( i == 0x7F ) or ( i == 0x22 ) or
- ( i == 0x3C ) or ( i == 0x3E )
+ if ( i >= 0x00 and i <= 0x08 ) or ( i >= 0x0B and i <= 0x0C ) or
+ ( i >= 0x0E and i <= 0x1F ) or ( i == 0x7F )
+ then
+ return ""
+
+ elseif ( i == 0x26 ) or ( i == 0x27 ) or ( i == 0x22 ) or
+ ( i == 0x3C ) or ( i == 0x3E )
then
return string.format("&#%i;", i)
end