fix: crash on invalid input to policy set (#3610)

This commit is contained in:
Aditya Manthramurthy
2021-02-12 11:22:02 -08:00
committed by GitHub
parent 7c0fb6a99e
commit 4eb6f999a6
+1 -1
View File
@@ -67,7 +67,7 @@ func checkAdminPolicySetSyntax(ctx *cli.Context) {
func parseEntityArg(arg string) (userOrGroup string, isGroup bool, err error) {
parts := strings.SplitN(arg, "=", 2)
switch {
case parts[1] == "":
case len(parts) != 2 || parts[1] == "":
err = errBadUserGroupArg
case strings.ToLower(parts[0]) == "user":
userOrGroup = parts[1]