check for null byte passed as parameter

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@629623 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-02-20 21:47:18 +00:00
parent 4e3e8c4add
commit bca91bb068
1 changed files with 10 additions and 8 deletions

View File

@ -82,14 +82,16 @@ public class TcpBufferedOutputStream extends FilterOutputStream {
* @throws IOException * @throws IOException
*/ */
public void write(byte b[], int off, int len) throws IOException { public void write(byte b[], int off, int len) throws IOException {
if ((bufferlen - count) < len) { if (b != null) {
flush(); if ((bufferlen - count) < len) {
} flush();
if (buffer.length >= len) { }
System.arraycopy(b, off, buffer, count, len); if (buffer.length >= len) {
count += len; System.arraycopy(b, off, buffer, count, len);
} else { count += len;
out.write(b, off, len); } else {
out.write(b, off, len);
}
} }
} }