1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-03 18:47:41 +08:00

fix packet error.

This commit is contained in:
Mrs4s 2020-08-22 00:42:44 +08:00
parent 80481f0022
commit fe8e98b9d8
2 changed files with 4 additions and 1 deletions

View File

@ -44,7 +44,6 @@ func (c *QQClient) highwayUploadImage(ip uint32, port int, updKey, img []byte, c
hl, _ := r.ReadInt32()
_, _ = r.ReadBytes(4)
payload, _ := r.ReadBytes(int(hl))
_ = conn.Close()
rsp := new(pb.RspDataHighwayHead)
if err = proto.Unmarshal(payload, rsp); err != nil {
return err

View File

@ -8,6 +8,7 @@ import (
)
var ErrUnknownFlag = errors.New("unknown flag")
var ErrInvalidPayload = errors.New("invalid payload")
var ErrDecryptFailed = errors.New("decrypt failed")
type ISendingPacket interface {
@ -83,6 +84,9 @@ func BuildSsoPacket(seq uint16, commandName, imei string, extData, outPacketSess
}
func ParseIncomingPacket(payload, d2key []byte) (*IncomingPacket, error) {
if len(payload) < 6 {
return nil, ErrInvalidPayload
}
reader := binary.NewReader(payload)
flag1 := reader.ReadInt32()
flag2 := reader.ReadByte()