From 9681f58b219c58c8e7ab40f9a4425c3f7cdeb8a0 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 16 May 2013 04:30:45 -0700 Subject: [PATCH] 8010814: More buffers are stored or returned without cloning Reviewed-by: lancea --- jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java | 2 +- jdk/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/jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java b/jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java index 44b46f844b8..55b46d36322 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java +++ b/jdk/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/jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java b/jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java index fc8566dad49..a641b0dd7a4 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java +++ b/jdk/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/jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java b/jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java index 737036155ce..28745bdb0d5 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java +++ b/jdk/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(); } /**