bounds checking

This commit is contained in:
Paul Stuart 2016-05-14 16:45:44 -07:00
parent a6071708c6
commit da8934445a
1 changed files with 3 additions and 0 deletions

View File

@ -553,6 +553,9 @@ func parseFile(fpath string) (*ast.Table, error) {
for _, env_var := range env_vars { for _, env_var := range env_vars {
str := strings.TrimPrefix(string(env_var), "$(") str := strings.TrimPrefix(string(env_var), "$(")
args := strings.Fields(strings.TrimSuffix(str, ")")) args := strings.Fields(strings.TrimSuffix(str, ")"))
if len(args) == 0 {
return nil, fmt.Errorf("Empty command string")
}
v, err := exec.Command(args[0], args[1:]...).Output() v, err := exec.Command(args[0], args[1:]...).Output()
if err != nil { if err != nil {
return nil, err return nil, err