mirror of
https://github.com/go-delve/delve.git
synced 2025-10-30 10:17:03 +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 {
|
func (c *Commands) deferredCommand(t *Term, ctx callContext, argstr string) error {
|
||||||
ctx.Prefix = deferredPrefix
|
ctx.Prefix = deferredPrefix
|
||||||
|
|
||||||
space := strings.Index(argstr, " ")
|
space := strings.IndexRune(argstr, ' ')
|
||||||
|
if space < 0 {
|
||||||
|
return errors.New("not enough arguments")
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
ctx.Scope.DeferredCall, err = strconv.Atoi(argstr[:space])
|
ctx.Scope.DeferredCall, err = strconv.Atoi(argstr[:space])
|
||||||
|
|||||||
Reference in New Issue
Block a user