mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +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)
|
time.Sleep(time.Millisecond * 500)
|
||||||
continue
|
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)
|
data, _ := c.TCP.ReadBytes(int(l) - 4)
|
||||||
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
|
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -203,7 +211,6 @@ func (c *QQClient) netLoop() {
|
|||||||
errCount++
|
errCount++
|
||||||
if errCount > 2 {
|
if errCount > 2 {
|
||||||
go c.quickReconnect()
|
go c.quickReconnect()
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user