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
1 changed files with 16 additions and 5 deletions

View File

@ -143,6 +143,9 @@ public class IBBTransferNegotiator extends StreamNegotiator {
public void cleanup() {
}
public void cancel() {
}
private class IBBOutputStream extends OutputStream {
protected byte[] buffer;
@ -191,9 +194,16 @@ public class IBBTransferNegotiator extends StreamNegotiator {
public synchronized void write(byte b[], int off, int len)
throws IOException {
if (len >= buffer.length) {
throw new IllegalArgumentException(
"byte size exceeds blocksize");
// "byte" off the first chunck to write out
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) {
flushBuffer();
}
@ -216,11 +226,12 @@ public class IBBTransferNegotiator extends StreamNegotiator {
ext.setData(enc);
ext.setSeq(seq);
synchronized(this) {
synchronized (this) {
try {
this.wait(100);
}
catch (InterruptedException e) {
/* Do Nothing */
}
}
@ -333,7 +344,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
data = (IBBExtensions.Data) mess.getExtension(
IBBExtensions.Data.ELEMENT_NAME,
IBBExtensions.NAMESPACE);
checkSequence(mess, (int) data.getSeq());
buffer = Base64.decode(data.getData());
bufferPointer = 0;
@ -394,7 +405,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
if (isEOF) {
sendCloseConfirmation();
}
else if(lastMess != null) {
else if (lastMess != null) {
sendCancelMessage(lastMess);
}
isClosed = true;