mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix: panic with invalid packet length.
This commit is contained in:
parent
a3eacd706b
commit
d2c218e92b
@ -191,6 +191,14 @@ func (c *QQClient) netLoop() {
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
continue
|
||||
}
|
||||
if l <= 0 || l > 1024*1024*10 { // max 10MB
|
||||
c.Error("parse incoming packet error: invalid packet length %v", l)
|
||||
errCount++
|
||||
if errCount > 2 {
|
||||
go c.quickReconnect()
|
||||
}
|
||||
continue
|
||||
}
|
||||
data, _ := c.TCP.ReadBytes(int(l) - 4)
|
||||
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
|
||||
if err != nil {
|
||||
@ -203,7 +211,6 @@ func (c *QQClient) netLoop() {
|
||||
errCount++
|
||||
if errCount > 2 {
|
||||
go c.quickReconnect()
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user