summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2006-02-15 20:29:45 +0000
committerMark Spruiell <mes@zeroc.com>2006-02-15 20:29:45 +0000
commit4a82c2cbe2e0a3450aff9f61a4194aa423f32b19 (patch)
treeda33a3fb17718cdf1bf754b6ba775c211726bd54 /cpp/src/Ice/ThreadPool.cpp
parentFixed bug 864 (diff)
downloadice-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/ThreadPool.cpp')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index ec0e7e3b6b5..15bda6f74fe 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -755,7 +755,13 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
}
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)));