From 4a82c2cbe2e0a3450aff9f61a4194aa423f32b19 Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Wed, 15 Feb 2006 20:29:45 +0000 Subject: changing assertion to exception to avoid vulnerability with small UDP packets --- cpp/src/Ice/ThreadPool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cpp/src/Ice/ThreadPool.cpp') 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 m; stream.readBlob(m, static_cast(sizeof(magic))); -- cgit v1.2.3