mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
auth: remove index out of range in role grant
Fixes https://github.com/coreos/etcd/issues/5077
This commit is contained in:
parent
ac95cc32ef
commit
a016220648
@ -279,7 +279,7 @@ func (as *authStore) RoleGrant(r *pb.AuthRoleGrantRequest) (*pb.AuthRoleGrantRes
|
||||
return bytes.Compare(role.KeyPermission[i].Key, []byte(r.Perm.Key)) >= 0
|
||||
})
|
||||
|
||||
if bytes.Equal(role.KeyPermission[idx].Key, r.Perm.Key) {
|
||||
if idx < len(role.KeyPermission) && bytes.Equal(role.KeyPermission[idx].Key, r.Perm.Key) {
|
||||
// update existing permission
|
||||
role.KeyPermission[idx].PermType = r.Perm.PermType
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user