From a15a8dc4106d23851d77fecaed8d77c749cfcb37 Mon Sep 17 00:00:00 2001 From: xuelei Date: Thu, 16 May 2013 04:30:45 -0700 Subject: [PATCH] 8010814: More buffers are stored or returned without cloning Reviewed-by: lancea --- src/share/classes/com/sun/jndi/ldap/BerDecoder.java | 2 +- src/share/classes/com/sun/jndi/ldap/BerEncoder.java | 2 +- .../classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/share/classes/com/sun/jndi/ldap/BerDecoder.java b/src/share/classes/com/sun/jndi/ldap/BerDecoder.java index 44b46f844..55b46d363 100644 --- a/src/share/classes/com/sun/jndi/ldap/BerDecoder.java +++ b/src/share/classes/com/sun/jndi/ldap/BerDecoder.java @@ -42,7 +42,7 @@ public final class BerDecoder extends Ber { */ public BerDecoder(byte buf[], int offset, int bufsize) { - this.buf = buf; + this.buf = buf; // shared buffer, be careful to use this class this.bufsize = bufsize; this.origOffset = offset; diff --git a/src/share/classes/com/sun/jndi/ldap/BerEncoder.java b/src/share/classes/com/sun/jndi/ldap/BerEncoder.java index fc8566dad..a641b0dd7 100644 --- a/src/share/classes/com/sun/jndi/ldap/BerEncoder.java +++ b/src/share/classes/com/sun/jndi/ldap/BerEncoder.java @@ -99,7 +99,7 @@ public final class BerEncoder extends Ber { if (curSeqIndex != 0) { throw new IllegalStateException("BER encode error: Unbalanced SEQUENCEs."); } - return buf; + return buf; // shared buffer, be careful to use this method. } /** diff --git a/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java b/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java index 737036155..28745bdb0 100644 --- a/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java +++ b/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java @@ -134,7 +134,9 @@ final public class StartTlsResponseImpl extends StartTlsResponse { * @see #negotiate */ public void setEnabledCipherSuites(String[] suites) { - this.suites = suites; + // The impl does accept null suites, although the spec requires + // a non-null list. + this.suites = suites == null ? null : suites.clone(); } /** -- GitLab