chiark / gitweb /
keyfunc.sh: Protect arguments to expr(1).
authorMark Wooding <mdw@distorted.org.uk>
Sat, 7 Jan 2012 02:08:18 +0000 (02:08 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 7 Jan 2012 16:12:41 +0000 (16:12 +0000)
Make sure they don't look like operators or functions.

keyfunc.sh.in

index 38ca243..2a10f26 100644 (file)
@@ -144,7 +144,7 @@ check () {
   validp=t
   case "$thing" in
     *"$nl"*) validp=nil ;;
-    *) if ! expr >/dev/null "$thing" : "$ckpat\$"; then validp=nil; fi ;;
+    *) if ! expr >/dev/null "Q$thing" : "Q$ckpat\$"; then validp=nil; fi ;;
   esac
   case $validp in
     nil) echo >&2 "$quis: bad $ckwhat \`$thing'"; exit 1 ;;