From 7a72473daac48164b0ea2618421312d7dd854095 Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Sat, 20 Feb 2021 14:34:12 +0800 Subject: [PATCH] fix t119 panic. --- client/c2c_processor.go | 1 - client/group_file.go | 2 +- client/tlv_decoders.go | 8 +++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/c2c_processor.go b/client/c2c_processor.go index 9d149007..319e61ae 100644 --- a/client/c2c_processor.go +++ b/client/c2c_processor.go @@ -11,7 +11,6 @@ import ( "google.golang.org/protobuf/proto" ) -// com.tencent.mobileqq.app.QQMessageFacadeConfig::start var c2cDecoders = map[int32]func(*QQClient, *msg.Message){ 33: troopAddMemberBroadcastDecoder, 35: troopSystemMessageDecoder, 36: troopSystemMessageDecoder, 37: troopSystemMessageDecoder, diff --git a/client/group_file.go b/client/group_file.go index 402cd4c6..3e1af9af 100644 --- a/client/group_file.go +++ b/client/group_file.go @@ -4,6 +4,7 @@ import ( "crypto/sha1" "encoding/hex" "fmt" + "google.golang.org/protobuf/proto" "io" "math/rand" "os" @@ -13,7 +14,6 @@ import ( "github.com/Mrs4s/MiraiGo/client/pb/oidb" "github.com/Mrs4s/MiraiGo/protocol/packets" "github.com/Mrs4s/MiraiGo/utils" - "github.com/golang/protobuf/proto" "github.com/pkg/errors" ) diff --git a/client/tlv_decoders.go b/client/tlv_decoders.go index b1e0e296..88c6e0fb 100644 --- a/client/tlv_decoders.go +++ b/client/tlv_decoders.go @@ -104,9 +104,11 @@ func (c *QQClient) decodeT119(data []byte) { } key := md5.Sum(append(append(c.PasswordMd5[:], []byte{0x00, 0x00, 0x00, 0x00}...), binary.NewWriterF(func(w *binary.Writer) { w.WriteUInt32(uint32(c.Uin)) })...)) decrypted := binary.NewTeaCipher(key[:]).Decrypt(c.sigInfo.encryptedA1) - dr := binary.NewReader(decrypted) - dr.ReadBytes(51) - SystemDeviceInfo.TgtgtKey = dr.ReadBytes(16) + if len(decrypted) > 51+16 { + dr := binary.NewReader(decrypted) + dr.ReadBytes(51) + SystemDeviceInfo.TgtgtKey = dr.ReadBytes(16) + } c.Nickname = nick c.Age = age c.Gender = gender