From dd38f77dbb61adced65fcf71e1cd8e8abadf286f Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 16 Apr 2022 14:15:48 +0100 Subject: [PATCH] Provision for profiles being sent with messages --- .../com/muwire/core/connection/ConnectionAcceptor.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy b/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy index 9d21c683..3fa17044 100644 --- a/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy @@ -740,6 +740,13 @@ class ConnectionAcceptor { throw new Exception("unrecognized version") int count = Integer.parseInt(headers['Count']) + if (headers.containsKey("Profile") && Boolean.parseBoolean(headers['Profile'])) { + int profileLength = dis.readInt() + if (profileLength > Constants.MAX_PROFILE_LENGTH) + throw new IOException("Profile too big $profileLength") + dis.skipBytes(profileLength) // skip for now + } + dis = new DataInputStream(new GZIPInputStream(dis)) count.times { MWMessage m = new MWMessage(dis)