Skip to content

Commit

Permalink
length check for parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Aug 10, 2023
1 parent be889b2 commit 40d0c4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func Parse(reader io.Reader) ([]Command, error) {
command.Args = string(fields[1])
case "PARAMETER":
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.Args = string(fields[1])
default:
Expand Down

0 comments on commit 40d0c4a

Please sign in to comment.