terminal/command: fix up OoB in deferred command (#2823)

Prior to this, sending a `deferred` command with no arguments would immediately
crash the debug session.
This commit is contained in:
kaddy-tom
2021-12-10 20:52:05 +11:00
committed by GitHub
parent 2f13672765
commit 15bb95ccc3

View File

@ -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])