fishi0x01 / vsh

vsh - HashiCorp Vault interactive shell and cli tool
MIT License
284 stars 12 forks source link

panic: runtime error: index out of range #10

Closed dharrigan closed 5 years ago

dharrigan commented 5 years ago

Hi,

Interesting project, got a panic:

% vsh         
http://vault:8200 /> cd 
panic: runtime error: index out of range

goroutine 1 [running]:
main.executor(0xc00001e216, 0x3)
    /home/fishi/Workspaces/fishi0x01/vsh/main.go:65 +0x6c5
github.com/c-bata/go-prompt.(*Prompt).Run(0xc0001ac400)
    /home/fishi/Workspaces/fishi0x01/vsh/vendor/github.com/c-bata/go-prompt/prompt.go:85 +0x7f2
main.main()
    /home/fishi/Workspaces/fishi0x01/vsh/main.go:144 +0x51a

I did this by simply running up vsh, selecting cd and pressing return without choosing the suggestion.

In fact, it seems to happen with all suggestions, without choosing the suggestion, i.e., cp, rm etc...

fishi0x01 commented 5 years ago

Yes you are absolutely right. Some sanity checks are still missing. Will add them later today :+1:

fishi0x01 commented 5 years ago

Merged a fix with some basic sanity checking which should prevent panics like above. However, more sanity checks / better error handling will be added in the (near) future.

dharrigan commented 5 years ago

Fantastic. Will test.

Yup, much better - no crashing :+1: Thanks for fixing!