mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
fix gacha rewards overflowing
This commit is contained in:
@@ -600,7 +600,8 @@ func handleMsgMhfReceiveGachaItem(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
data = []byte{0x00}
|
data = []byte{0x00}
|
||||||
}
|
}
|
||||||
|
|
||||||
if data[0] > 36 {
|
// I think there are still some edge cases where rewards can be nulled via overflow
|
||||||
|
if data[0] > 36 || len(data) > 181 {
|
||||||
resp := byteframe.NewByteFrame()
|
resp := byteframe.NewByteFrame()
|
||||||
resp.WriteUint8(36)
|
resp.WriteUint8(36)
|
||||||
resp.WriteBytes(data[1:181])
|
resp.WriteBytes(data[1:181])
|
||||||
@@ -610,7 +611,7 @@ func handleMsgMhfReceiveGachaItem(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !pkt.Freeze {
|
if !pkt.Freeze {
|
||||||
if data[0] > 36 {
|
if data[0] > 36 || len(data) > 181 {
|
||||||
update := byteframe.NewByteFrame()
|
update := byteframe.NewByteFrame()
|
||||||
update.WriteUint8(uint8(len(data[181:]) / 5))
|
update.WriteUint8(uint8(len(data[181:]) / 5))
|
||||||
update.WriteBytes(data[181:])
|
update.WriteBytes(data[181:])
|
||||||
|
|||||||
Reference in New Issue
Block a user