summaryrefslogtreecommitdiff
path: root/csharp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-06-09 18:45:36 +0200
committerJose <jose@zeroc.com>2015-06-09 18:45:36 +0200
commit212b46f6fd0aaec3d7e4a7be8df3dc9f3cee5d63 (patch)
treea38b3333a001947e9b3a538136b1b1b55da22da3 /csharp/src
parentICE-6553 - Ruby segfault in slicing/objects test (diff)
downloadice-212b46f6fd0aaec3d7e4a7be8df3dc9f3cee5d63.tar.bz2
ice-212b46f6fd0aaec3d7e4a7be8df3dc9f3cee5d63.tar.xz
ice-212b46f6fd0aaec3d7e4a7be8df3dc9f3cee5d63.zip
Fix Web Socket protocol bug when reading message payload
Diffstat (limited to 'csharp/src')
-rw-r--r--csharp/src/Ice/WSTransceiver.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/csharp/src/Ice/WSTransceiver.cs b/csharp/src/Ice/WSTransceiver.cs
index 98dd6f8fdae..09249d663da 100644
--- a/csharp/src/Ice/WSTransceiver.cs
+++ b/csharp/src/Ice/WSTransceiver.cs
@@ -1234,9 +1234,13 @@ namespace IceInternal
return false;
}
- if(_readBufferPos < _readBuffer.b.position())
+ int n = Math.Min(_readBuffer.b.position() - _readBufferPos, buf.b.remaining());
+ if(n > _readPayloadLength)
{
- int n = Math.Min(_readBuffer.b.position() - _readBufferPos, buf.b.remaining());
+ n = _readPayloadLength;
+ }
+ if(n > 0)
+ {
System.Buffer.BlockCopy(_readBuffer.b.rawBytes(), _readBufferPos, buf.b.rawBytes(),
buf.b.position(), n);
buf.b.position(buf.b.position() + n);
@@ -1247,7 +1251,7 @@ namespace IceInternal
// Continue reading if we didn't read the full message, otherwise give back
// the control to the connection
//
- return buf.b.hasRemaining();
+ return buf.b.hasRemaining() && n < _readPayloadLength;
}
}
}