[Patch] gnu.java.net.BASE64

Michael Koch konqueror@gmx.de
Mon Apr 18 19:33:00 GMT 2005


Hi list,


I just merged the attached patch from GNU classpath to HEAD.
It fixes a byte array truncation problem.


Michael


2005-04-18  Chris Burdess  <dog@gnu.org>

	* gnu/java/net/BASE64.java: Truncate encoded byte array.

-------------- next part --------------
Index: gnu/java/net/BASE64.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/BASE64.java,v
retrieving revision 1.1
diff -u -r1.1 BASE64.java
--- gnu/java/net/BASE64.java	11 Jan 2005 20:19:53 -0000	1.1
+++ gnu/java/net/BASE64.java	18 Apr 2005 19:31:19 -0000
@@ -1,5 +1,5 @@
 /* BASE.java --
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -109,6 +109,12 @@
             bt[ti++] = src[b3 & 0x3f];
           }
       }
+     if (ti < bt.length)
+      {
+	byte[] tmp = new byte[ti];
+	System.arraycopy(bt, 0, tmp, 0, ti);
+	bt = tmp;
+      }
     /*while (ti < bt.length)
       {
         bt[ti++] = 0x3d;


More information about the Java-patches mailing list