diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-02-15 20:29:45 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-02-15 20:29:45 +0000 |
commit | 4a82c2cbe2e0a3450aff9f61a4194aa423f32b19 (patch) | |
tree | da33a3fb17718cdf1bf754b6ba775c211726bd54 /cpp/src/Ice/ConnectionI.cpp | |
parent | Fixed bug 864 (diff) | |
download | ice-4a82c2cbe2e0a3450aff9f61a4194aa423f32b19.tar.bz2 ice-4a82c2cbe2e0a3450aff9f61a4194aa423f32b19.tar.xz ice-4a82c2cbe2e0a3450aff9f61a4194aa423f32b19.zip |
changing assertion to exception to avoid vulnerability with small UDP
packets
Diffstat (limited to 'cpp/src/Ice/ConnectionI.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 9504acde619..10d7ade49de 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -2357,7 +2357,13 @@ Ice::ConnectionI::run() _transceiver->read(stream, -1); ptrdiff_t pos = stream.i - stream.b.begin(); - assert(pos >= headerSize); + if(pos < headerSize) + { + // + // This situation is possible for small UDP packets. + // + throw IllegalMessageSizeException(__FILE__, __LINE__); + } stream.i = stream.b.begin(); pair<const Byte*, const Byte*> m; stream.readBlob(m, static_cast<Int>(sizeof(magic))); |