grim/convey

Harden regex for ${var}.
expand-list
2017-10-03, Eric Fritz
ee97ff3b6550
Harden regex for ${var}.
--- a/state/util.go Tue Oct 03 22:13:07 2017 -0500
+++ b/state/util.go Tue Oct 03 22:17:51 2017 -0500
@@ -21,8 +21,8 @@
"regexp"
)
-var re1 = regexp.MustCompile("\\$[A-Za-z0-9_]+")
-var re2 = regexp.MustCompile("\\${[A-Za-z0-9_]+}")
+var re1 = regexp.MustCompile("\\$[A-Za-z_][A-Za-z0-9_]*")
+var re2 = regexp.MustCompile("\\${[A-Za-z_][A-Za-z0-9_]*}")
// getNames extracts all variables with the format $var or ${var} from
// the given string.