"tests/nn/vscode:/vscode.git/clone" did not exist on "daa1bad5d3f536c4880eea2b2f4af84291b2976c"
Commit 40d0c4a1 authored by Michael Yang's avatar Michael Yang
Browse files

length check for parameters

parent be889b2f
...@@ -45,6 +45,10 @@ func Parse(reader io.Reader) ([]Command, error) { ...@@ -45,6 +45,10 @@ func Parse(reader io.Reader) ([]Command, error) {
command.Args = string(fields[1]) command.Args = string(fields[1])
case "PARAMETER": case "PARAMETER":
fields = bytes.SplitN(fields[1], []byte(" "), 2) fields = bytes.SplitN(fields[1], []byte(" "), 2)
if len(fields) < 2 {
return nil, fmt.Errorf("missing value for %s", fields)
}
command.Name = string(fields[0]) command.Name = string(fields[0])
command.Args = string(fields[1]) command.Args = string(fields[1])
default: default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment