sanitize json_get_type function
authorLuka Perkov <luka@openwrt.org>
Fri, 4 Jan 2013 10:26:08 +0000 (11:26 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 4 Jan 2013 12:28:08 +0000 (13:28 +0100)
Signed-off-by: Luka Perkov <luka@openwrt.org>
sh/jshn.sh

index 70c3aa36b3f026d3f62634316927409c98b87d26..1c357110b3eac7e1001ddae18fc963f04bda2c47 100644 (file)
@@ -197,7 +197,7 @@ json_get_type() {
        local cur
 
        _json_get_var cur JSON_CUR
-       local var="${JSON_PREFIX}TYPE_${cur}_$2"
+       local var="${JSON_PREFIX}TYPE_${cur}_${2//[^a-zA-Z0-9_]/_}"
        eval "export -- \"$dest=\${$var}\"; [ -n \"\${$var+x}\" ]"
 }