changeset 7147:b198389f9da4

8010814: More buffers are stored or returned without cloning Reviewed-by: lancea
author xuelei
date Thu, 16 May 2013 04:30:45 -0700
parents bb01cc14223c
children 81c449fd18fe 74f91b7f4b66 da203779cb33
files src/share/classes/com/sun/jndi/ldap/BerDecoder.java src/share/classes/com/sun/jndi/ldap/BerEncoder.java src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java
diffstat 3 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/ldap/BerDecoder.java	Thu May 16 10:59:06 2013 +0100
+++ b/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/src/share/classes/com/sun/jndi/ldap/BerEncoder.java	Thu May 16 10:59:06 2013 +0100
+++ b/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/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu May 16 10:59:06 2013 +0100
+++ b/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();
     }
 
     /**