From ca9f36f7375b5329c3dc7ce7a408ea2e3b7ffa4a Mon Sep 17 00:00:00 2001 From: Vojtech Juranek Date: Mon, 12 May 2014 22:06:36 +0200 Subject: [PATCH] Use proper array lenght See PR #1233 and discussion therein. (cherry picked from commit b8c3f61c907d58a024e7122a7549fff8de75a482) --- .../java/jenkins/security/LastGrantedAuthoritiesProperty.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/jenkins/security/LastGrantedAuthoritiesProperty.java b/core/src/main/java/jenkins/security/LastGrantedAuthoritiesProperty.java index a506b23243..3fca03da53 100644 --- a/core/src/main/java/jenkins/security/LastGrantedAuthoritiesProperty.java +++ b/core/src/main/java/jenkins/security/LastGrantedAuthoritiesProperty.java @@ -50,7 +50,7 @@ public class LastGrantedAuthoritiesProperty extends UserProperty { GrantedAuthority[] r = new GrantedAuthority[roles==null ? 1 : roles.length+1]; r[0] = SecurityRealm.AUTHENTICATED_AUTHORITY; if (roles != null) { - for (int i = 1; i < roles.length; i++) { + for (int i = 1; i < r.length; i++) { r[i] = new GrantedAuthorityImpl(roles[i - 1]); } } -- GitLab