From 10f58e24ca7a7172b0959775d42e55dce975c744 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 24 Apr 2023 07:59:49 +0000 Subject: [PATCH] 1 --- server/wsproxy/kcpsession.cc | 2 +- server/wsproxy/kcpsession.h | 2 +- server/wsproxy/longsessionmgr.cc | 2 +- third_party/a8 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/wsproxy/kcpsession.cc b/server/wsproxy/kcpsession.cc index fc41b91..9523051 100644 --- a/server/wsproxy/kcpsession.cc +++ b/server/wsproxy/kcpsession.cc @@ -100,7 +100,7 @@ void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen) p->seqid, &buf[offset + sizeof(f8::PackHead) + GetSecretKeyLen()], p->packlen); - offset += sizeof(f8::PackHead) + p->packlen; + offset += sizeof(f8::PackHead) + p->packlen + GetSecretKeyLen(); } else { warning = true; offset++; diff --git a/server/wsproxy/kcpsession.h b/server/wsproxy/kcpsession.h index c1ee0e9..91104b6 100644 --- a/server/wsproxy/kcpsession.h +++ b/server/wsproxy/kcpsession.h @@ -22,7 +22,7 @@ public: void SendClientMsg(char* buf, int buf_len); virtual void OnRecvPacket(a8::UdpPacket* pkt) override; - static int GetSecretKeyLen() { return sizeof(long long) / 4; } + static int GetSecretKeyLen() { return sizeof(long long); } static long long ReadSecretKey(const char* buf, int buf_len) { return buf_len < GetSecretKeyLen() ? 0 : *((long long*)buf); diff --git a/server/wsproxy/longsessionmgr.cc b/server/wsproxy/longsessionmgr.cc index 0a1bbda..4600840 100644 --- a/server/wsproxy/longsessionmgr.cc +++ b/server/wsproxy/longsessionmgr.cc @@ -84,7 +84,7 @@ void LongSessionMgr::ProcUdpPacket(a8::UdpPacket* pkt) const int IKCP_OVERHEAD = 24; if (pkt->buf_len > IKCP_OVERHEAD + KcpSession::GetSecretKeyLen()) { int socket_handle = ikcp_getconv(pkt->buf); - long long secret_key = KcpSession::ReadSecretKey(pkt->buf, pkt->buf_len); + long long secret_key = KcpSession::ReadSecretKey(pkt->buf + IKCP_OVERHEAD, pkt->buf_len); auto session = GetSession(socket_handle); if (session && secret_key == session->GetKcpSession()->GetSecretKey()) { session->GetKcpSession()->OnRecvPacket(pkt); diff --git a/third_party/a8 b/third_party/a8 index e24aab0..afffb63 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit e24aab092d253aab99b2d8e8a2ac4b3d635162e1 +Subproject commit afffb63a95cf4e0486410388f74cfcd4a6aac206