mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22: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:
parent
f70e9b894d
commit
e8c0266740
1 changed files with 16 additions and 5 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -216,11 +226,12 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
|
|
||||||
ext.setData(enc);
|
ext.setData(enc);
|
||||||
ext.setSeq(seq);
|
ext.setSeq(seq);
|
||||||
synchronized(this) {
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
this.wait(100);
|
this.wait(100);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
|
/* Do Nothing */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +344,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
data = (IBBExtensions.Data) mess.getExtension(
|
data = (IBBExtensions.Data) mess.getExtension(
|
||||||
IBBExtensions.Data.ELEMENT_NAME,
|
IBBExtensions.Data.ELEMENT_NAME,
|
||||||
IBBExtensions.NAMESPACE);
|
IBBExtensions.NAMESPACE);
|
||||||
|
|
||||||
checkSequence(mess, (int) data.getSeq());
|
checkSequence(mess, (int) data.getSeq());
|
||||||
buffer = Base64.decode(data.getData());
|
buffer = Base64.decode(data.getData());
|
||||||
bufferPointer = 0;
|
bufferPointer = 0;
|
||||||
|
@ -394,7 +405,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
if (isEOF) {
|
if (isEOF) {
|
||||||
sendCloseConfirmation();
|
sendCloseConfirmation();
|
||||||
}
|
}
|
||||||
else if(lastMess != null) {
|
else if (lastMess != null) {
|
||||||
sendCancelMessage(lastMess);
|
sendCancelMessage(lastMess);
|
||||||
}
|
}
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
|
|
Loading…
Reference in a new issue