Skip to content

skel: fix panic when binary is run without any arguments - #358

Open
pandaWall wants to merge 1 commit into
containerd:mainfrom
sig-cloudnative:skel--fix-panic
Open

pandaWall wants to merge 1 commit into
containerd:mainfrom
sig-cloudnative:skel--fix-panic

Conversation

@pandaWall

Copy link
Copy Markdown
Contributor

Run() indexes os.Args[1] unconditionally. When a plugin binary is started without any command argument, the process panics with "index out of range [1] with length 1" (and the panic happens even before the JSON request on stdin is read) instead of returning a proper error.

Guard the argument count and return an error. Also add a small regression test to verify that Run() doesn't panic without arguments anymore.

Run() indexes os.Args[1] unconditionally. When a plugin binary is
started without any command argument, the process panics with
"index out of range [1] with length 1" (and the panic happens even
before the JSON request on stdin is read) instead of returning a
proper error.

Guard the argument count and return an error. Also add a small
regression test to verify that Run() doesn't panic without
arguments anymore.

Signed-off-by: pandaWall <mangosteen922@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant