1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 22:12:05 +01:00

Illegal XML characters in presence status would crash connection. SMACK-132

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3766 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-04-13 20:18:26 +00:00 committed by alex
parent f70e9b894d
commit e8c0266740

View file

@ -143,6 +143,9 @@ public class IBBTransferNegotiator extends StreamNegotiator {
public void cleanup() { public void cleanup() {
} }
public void cancel() {
}
private class IBBOutputStream extends OutputStream { private class IBBOutputStream extends OutputStream {
protected byte[] buffer; protected byte[] buffer;
@ -191,9 +194,16 @@ public class IBBTransferNegotiator extends StreamNegotiator {
public synchronized void write(byte b[], int off, int len) public synchronized void write(byte b[], int off, int len)
throws IOException { throws IOException {
if (len >= buffer.length) { if (len >= buffer.length) {
throw new IllegalArgumentException( // "byte" off the first chunck to write out
"byte size exceeds blocksize"); writeOut(b, off, buffer.length);
// recursivly call this method again with the lesser amount subtracted.
write(b, off + buffer.length, len - buffer.length);
} else {
writeOut(b, off, len);
} }
}
private void writeOut(byte b[], int off, int len) {
if (len > buffer.length - count) { if (len > buffer.length - count) {
flushBuffer(); flushBuffer();
} }
@ -221,6 +231,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
this.wait(100); this.wait(100);
} }
catch (InterruptedException e) { catch (InterruptedException e) {
/* Do Nothing */
} }
} }