summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/WSTransceiver.cpp
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 /cpp/src/Ice/WSTransceiver.cpp
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 'cpp/src/Ice/WSTransceiver.cpp')
-rw-r--r--cpp/src/Ice/WSTransceiver.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp
index 08764fbc267..a1f27ef48a8 100644
--- a/cpp/src/Ice/WSTransceiver.cpp
+++ b/cpp/src/Ice/WSTransceiver.cpp
@@ -1370,19 +1370,23 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
return false;
}
- if(_readI < _readBuffer.i)
+ size_t n = min(_readBuffer.i - _readI, buf.b.end() - buf.i);
+
+ if(n > _readPayloadLength)
+ {
+ n = _readPayloadLength;
+ }
+ if(n > 0)
{
- size_t n = min(_readBuffer.i - _readI, buf.b.end() - buf.i);
memcpy(buf.i, _readI, n);
buf.i += n;
_readI += n;
}
-
//
// Continue reading if we didn't read the full message, otherwise give back
// the control to the connection
//
- return buf.i < buf.b.end();
+ return buf.i < buf.b.end() && n < _readPayloadLength;
}
}
}