8010814: More buffers are stored or returned without cloning
authorxuelei
Thu, 16 May 2013 04:30:45 -0700
changeset 17483 ed57f2f26fb6
parent 17482 c3efc9e2e227
child 17484 4ad440adc4b1
child 17485 feb8cd6a4c7d
child 17487 77566e5979d1
8010814: More buffers are stored or returned without cloning Reviewed-by: lancea
jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java
jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java
jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java
--- a/jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java	Thu May 16 10:59:06 2013 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/BerDecoder.java	Thu May 16 04:30:45 2013 -0700
@@ -42,7 +42,7 @@
      */
     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;
 
--- a/jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java	Thu May 16 10:59:06 2013 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/BerEncoder.java	Thu May 16 04:30:45 2013 -0700
@@ -99,7 +99,7 @@
         if (curSeqIndex != 0) {
             throw new IllegalStateException("BER encode error: Unbalanced SEQUENCEs.");
         }
-        return buf;
+        return buf;     // shared buffer, be careful to use this method.
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu May 16 10:59:06 2013 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu May 16 04:30:45 2013 -0700
@@ -134,7 +134,9 @@
      * @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();
     }
 
     /**