aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/ServerReadBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nxcomp/ServerReadBuffer.cpp')
-rw-r--r--nxcomp/ServerReadBuffer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/nxcomp/ServerReadBuffer.cpp b/nxcomp/ServerReadBuffer.cpp
index 96c146b77..069da2b45 100644
--- a/nxcomp/ServerReadBuffer.cpp
+++ b/nxcomp/ServerReadBuffer.cpp
@@ -108,14 +108,21 @@ int ServerReadBuffer::locateMessage(const unsigned char *start,
{
dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2);
}
+ else if (*start == GenericEvent && *(start+1) != 0)
+ {
+ // X Generic Event Extension
+ dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2);
+ }
else
{
dataLength = 32;
}
- if (dataLength < 32)
+// See WRITE_BUFFER_OVERFLOW_SIZE elsewhere
+// and also ENCODE_BUFFER_OVERFLOW_SIZE DECODE_BUFFER_OVERFLOW_SIZE.
+ if (dataLength < 32 || dataLength > 100*1024*1024)
{
- #ifdef TEST
+ #ifdef WARNING
*logofs << "ServerReadBuffer: WARNING! Assuming length 32 "
<< "for suspicious message of length " << dataLength
<< ".\n" << logofs_flush;