fix bug in websocket library

This commit is contained in:
Erik 2015-08-17 00:09:04 -04:00
parent 0fd8a9540b
commit 6ee1daeaf7

View File

@ -495,7 +495,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
dataLength = UInt64(bytes[0].bigEndian)
offset += sizeof(UInt16)
}
if bufferLen < offset {
if bufferLen < offset || UInt64(bufferLen - offset) < dataLength {
fragBuffer = NSData(bytes: buffer, length: bufferLen)
return
}