mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 17:56:45 +08:00
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:
@ -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])
|
||||
|
||||
Reference in New Issue
Block a user