Author: sback
Date: 2007-06-26 09:48:37 +0000 (Tue, 26 Jun 2007)
New Revision: 13757

Modified:
   trunk/freenet/src/freenet/support/HexUtil.java
Log:
Added a control (which can raise an exception) over the 
hexToBytes(String,byte[],int) last argument value

Modified: trunk/freenet/src/freenet/support/HexUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/HexUtil.java      2007-06-26 09:15:57 UTC 
(rev 13756)
+++ trunk/freenet/src/freenet/support/HexUtil.java      2007-06-26 09:48:37 UTC 
(rev 13757)
@@ -80,6 +80,10 @@
         */
        public static final void hexToBytes(String s, byte[] out, int off)
                throws NumberFormatException, IndexOutOfBoundsException {
+               
+               if (off >= out.length)
+                       throw new IllegalArgumentException();
+               
                int slen = s.length();
                if ((slen % 2) != 0) {
                        s = '0' + s;


Reply via email to