diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-10-02 19:21:07 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-10-02 19:21:07 +0200 |
commit | 8fb855336e8f2fdf319c56253fb063f57346e8ad (patch) | |
tree | d87f11865f60178470fe107df05c60a88d5e6ad3 /cpp | |
parent | Conditional compilation of TCP transport with Swift builds (diff) | |
download | ice-8fb855336e8f2fdf319c56253fb063f57346e8ad.tar.bz2 ice-8fb855336e8f2fdf319c56253fb063f57346e8ad.tar.xz ice-8fb855336e8f2fdf319c56253fb063f57346e8ad.zip |
The Ice connection will now print warnings for first invalid messages received by a client, fixes #565
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 413a5d8775f..9fa189e089f 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1650,6 +1650,15 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) _observer->receivedBytes(static_cast<int>(headerSize)); } + // + // Connection is validated on first message. This is only used by + // setState() to check wether or not we can print a connection + // warning (a client might close the connection forcefully if the + // connection isn't validated, we don't want to print a warning + // in this case). + // + _validated = true; + ptrdiff_t pos = _readStream.i - _readStream.b.begin(); if(pos < headerSize) { @@ -1683,6 +1692,7 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) { throw IllegalMessageSizeException(__FILE__, __LINE__); } + if(size > static_cast<Int>(_messageSizeMax)) { Ex::throwMemoryLimitException(__FILE__, __LINE__, static_cast<size_t>(size), _messageSizeMax); @@ -2737,6 +2747,8 @@ Ice::ConnectionI::validate(SocketOperation operation) _observer.finishRead(_readStream); } + _validated = true; + assert(_readStream.i == _readStream.b.end()); _readStream.i = _readStream.b.begin(); Byte m[4]; @@ -2769,8 +2781,6 @@ Ice::ConnectionI::validate(SocketOperation operation) throw IllegalMessageSizeException(__FILE__, __LINE__); } traceRecv(_readStream, _logger, _traceLevels); - - _validated = true; } } @@ -3243,14 +3253,6 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request assert(stream.i == stream.b.end()); - // - // Connection is validated on first message. This is only used by - // setState() to check wether or not we can print a connection - // warning (a client might close the connection forcefully if the - // connection isn't validated). - // - _validated = true; - try { // |