mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix packet error.
This commit is contained in:
parent
80481f0022
commit
fe8e98b9d8
@ -44,7 +44,6 @@ func (c *QQClient) highwayUploadImage(ip uint32, port int, updKey, img []byte, c
|
|||||||
hl, _ := r.ReadInt32()
|
hl, _ := r.ReadInt32()
|
||||||
_, _ = r.ReadBytes(4)
|
_, _ = r.ReadBytes(4)
|
||||||
payload, _ := r.ReadBytes(int(hl))
|
payload, _ := r.ReadBytes(int(hl))
|
||||||
_ = conn.Close()
|
|
||||||
rsp := new(pb.RspDataHighwayHead)
|
rsp := new(pb.RspDataHighwayHead)
|
||||||
if err = proto.Unmarshal(payload, rsp); err != nil {
|
if err = proto.Unmarshal(payload, rsp); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var ErrUnknownFlag = errors.New("unknown flag")
|
var ErrUnknownFlag = errors.New("unknown flag")
|
||||||
|
var ErrInvalidPayload = errors.New("invalid payload")
|
||||||
var ErrDecryptFailed = errors.New("decrypt failed")
|
var ErrDecryptFailed = errors.New("decrypt failed")
|
||||||
|
|
||||||
type ISendingPacket interface {
|
type ISendingPacket interface {
|
||||||
@ -83,6 +84,9 @@ func BuildSsoPacket(seq uint16, commandName, imei string, extData, outPacketSess
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ParseIncomingPacket(payload, d2key []byte) (*IncomingPacket, error) {
|
func ParseIncomingPacket(payload, d2key []byte) (*IncomingPacket, error) {
|
||||||
|
if len(payload) < 6 {
|
||||||
|
return nil, ErrInvalidPayload
|
||||||
|
}
|
||||||
reader := binary.NewReader(payload)
|
reader := binary.NewReader(payload)
|
||||||
flag1 := reader.ReadInt32()
|
flag1 := reader.ReadInt32()
|
||||||
flag2 := reader.ReadByte()
|
flag2 := reader.ReadByte()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user