From 92bd29ebf18b988c448945bbc012e85e3630af80 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 30 Mar 2015 13:10:36 -0400 Subject: [PATCH] delete trailing paddings of SSU packtes --- SSUSession.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SSUSession.cpp b/SSUSession.cpp index edc5cb9f..1e4f0fe7 100644 --- a/SSUSession.cpp +++ b/SSUSession.cpp @@ -126,6 +126,8 @@ namespace transport void SSUSession::ProcessMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint) { + len -= (len & 0x0F); // %16, delete extra padding + if (len <= sizeof (SSUHeader)) return; // drop empty message //TODO: since we are accessing a uint8_t this is unlikely to crash due to alignment but should be improved SSUHeader * header = (SSUHeader *)buf; switch (header->GetPayloadType ())