1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-07-03 05:03:26 +00:00

fix sso frame panic

This commit is contained in:
Mrs4s
2021-12-21 13:15:59 +08:00
parent afb81a32aa
commit 21f8feb419

View File

@ -139,13 +139,13 @@ func parseSsoFrame(payload []byte, flag2 byte) (*IncomingPacket, error) {
}, nil }, nil
} }
compressedFlag := head.ReadInt32() compressedFlag := head.ReadInt32()
bodyLen := reader.ReadInt32() reader.ReadInt32()
packet := func() []byte { packet := func() []byte {
if compressedFlag == 0 { if compressedFlag == 0 {
return reader.ReadBytes(int(bodyLen) - 4) return reader.ReadAvailable()
} }
if compressedFlag == 1 { if compressedFlag == 1 {
return binary.ZlibUncompress(reader.ReadBytes(int(bodyLen) - 4)) return binary.ZlibUncompress(reader.ReadAvailable())
} }
if compressedFlag == 8 { if compressedFlag == 8 {
return reader.ReadAvailable() return reader.ReadAvailable()