From dc300f2c812b2231b527c761f4c73d5155137516 Mon Sep 17 00:00:00 2001 From: Cruz Julian Bishop Date: Fri, 29 Jun 2012 13:38:53 +1000 Subject: [PATCH] Fix a bug where a potential overflow occurs --- buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java index 18710d9819..bf59be816d 100644 --- a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java @@ -592,7 +592,7 @@ public class CompositeByteBuf extends AbstractByteBuf { * less than zero, or larger than {@code capacity()} */ public ByteBuf getBufferFor(int index) throws IndexOutOfBoundsException { - if (index < 0 || index > capacity()) { + if (index < 0 || index >= capacity()) { throw new IndexOutOfBoundsException("Invalid index: " + index + " - Bytes needed: " + index + ", maximum is " + capacity());