Author: sback
Date: 2007-06-14 16:03:38 +0000 (Thu, 14 Jun 2007)
New Revision: 13601

Modified:
   trunk/freenet/src/freenet/support/HexUtil.java
Log:
IllegalArgumentException thrown if method bytesToHex is called with a too long 
offset

Modified: trunk/freenet/src/freenet/support/HexUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/HexUtil.java      2007-06-14 15:54:58 UTC 
(rev 13600)
+++ trunk/freenet/src/freenet/support/HexUtil.java      2007-06-14 16:03:38 UTC 
(rev 13601)
@@ -32,6 +32,8 @@
         * @return the string of hex chars.
         */
        public static final String bytesToHex(byte[] bs, int off, int length) {
+               if (bs.length <= off)
+                       throw new IllegalArgumentException();
                StringBuffer sb = new StringBuffer(length * 2);
                bytesToHexAppend(bs, off, length, sb);
                return sb.toString();


Reply via email to