1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix sso frame panic

This commit is contained in:
Mrs4s 2021-12-21 13:15:59 +08:00
parent afb81a32aa
commit 21f8feb419
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

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()