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

fix: only read protobuf on known sub-type

Fixes Mrs4s/go-cqhttp#1120
This commit is contained in:
wdvxdr 2021-10-21 18:01:33 +08:00
parent 0ef4c01861
commit 80e2d83dab
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6
2 changed files with 4 additions and 1 deletions

View File

@ -90,6 +90,9 @@ func (r *JceReader) SkipField(c int) {
} }
func (r *JceReader) readBytes(len int) []byte { func (r *JceReader) readBytes(len int) []byte {
if len == 0 {
return nil
}
b := make([]byte, len) b := make([]byte, len)
_, err := r.buf.Read(b) _, err := r.buf.Read(b)
if err != nil { if err != nil {

View File

@ -113,8 +113,8 @@ func decodeOnlinePushReqPacket(c *QQClient, info *incomingPacketInfo, payload []
if m.MsgType == 528 { if m.MsgType == 528 {
vr := jce.NewJceReader(m.VMsg) vr := jce.NewJceReader(m.VMsg)
subType := vr.ReadInt64(0) subType := vr.ReadInt64(0)
protobuf := vr.ReadBytes(10)
if decoder, ok := msg0x210Decoders[subType]; ok { if decoder, ok := msg0x210Decoders[subType]; ok {
protobuf := vr.ReadBytes(10)
if err := decoder(c, protobuf); err != nil { if err := decoder(c, protobuf); err != nil {
return nil, errors.Wrap(err, "decode online push 0x210 error") return nil, errors.Wrap(err, "decode online push 0x210 error")
} }