8010814: More buffers are stored or returned without cloning
Reviewed-by: lancea
diff --git a/src/share/classes/com/sun/jndi/ldap/BerDecoder.java b/src/share/classes/com/sun/jndi/ldap/BerDecoder.java
index 44b46f8..55b46d3 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 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 fc8566d..a641b0d 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 @@
         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 7370361..28745bd 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 @@
      * @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();
     }
 
     /**