[freenet-cvs] r13601 - trunk/freenet/src/freenet/support

sback at freenetproject.org sback at freenetproject.org
Thu Jun 14 16:03:39 UTC 2007


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();




More information about the cvs mailing list