From 61d979bb419d59c11035556880890202fba38e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 3 Aug 2023 21:39:48 +0800 Subject: [PATCH] fix(listen): preshard key decode --- gold/link/listen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gold/link/listen.go b/gold/link/listen.go index bb46ba4..2c54672 100644 --- a/gold/link/listen.go +++ b/gold/link/listen.go @@ -62,11 +62,6 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) { switch { case p.IsToMe(packet.Dst): packet.Data = p.Decode(uint8(packet.TeaTypeDataSZ>>28), packet.Data) - if !packet.IsVaildHash() { - logrus.Debugln("[listen] drop invalid hash packet") - packet.Put() - continue - } if p.aead != nil { packet.Data = p.DecodePreshared(packet.AdditionalData(), packet.Data) if packet.Data == nil { @@ -75,6 +70,11 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) { continue } } + if !packet.IsVaildHash() { + logrus.Debugln("[listen] drop invalid hash packet") + packet.Put() + continue + } switch packet.Proto { case head.ProtoHello: switch p.status {