Skip to content

Commit

Permalink
terminal/command: fix up OoB in deferred command (go-delve#2823)
Browse files Browse the repository at this point in the history
Prior to this, sending a `deferred` command with no arguments would immediately
crash the debug session.
  • Loading branch information
kaddy-tom authored Dec 10, 2021
1 parent 2f13672 commit 15bb95c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/terminal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,10 @@ func (c *Commands) frameCommand(t *Term, ctx callContext, argstr string, directi
func (c *Commands) deferredCommand(t *Term, ctx callContext, argstr string) error {
ctx.Prefix = deferredPrefix

space := strings.Index(argstr, " ")
space := strings.IndexRune(argstr, ' ')
if space < 0 {
return errors.New("not enough arguments")
}

var err error
ctx.Scope.DeferredCall, err = strconv.Atoi(argstr[:space])
Expand Down

0 comments on commit 15bb95c

Please sign in to comment.