fix guild enumeration overflow

This commit is contained in:
wish
2022-10-12 22:44:08 +11:00
parent f346c181d3
commit 45b736db2d

View File

@@ -1260,9 +1260,16 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
bf = byteframe.NewByteFrame()
if pkt.Type > 8 {
if len(guilds) > 10 {
bf.WriteUint16(10)
} else {
bf.WriteUint16(uint16(len(alliances)))
}
bf.WriteUint8(0x00) // Unk
for _, alliance := range alliances {
for i, alliance := range alliances {
if i == 10 {
break
}
bf.WriteUint32(alliance.ID)
bf.WriteUint32(alliance.ParentGuild.LeaderCharID)
bf.WriteUint16(alliance.TotalMembers)
@@ -1280,10 +1287,17 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
bf.WriteUint8(0x01) // Unk
bf.WriteBool(true) // TODO: Enable GuildAlliance applications
}
} else {
if len(guilds) > 10 {
bf.WriteUint16(10)
} else {
bf.WriteUint16(uint16(len(guilds)))
}
bf.WriteUint8(0x01) // Unk
for _, guild := range guilds {
for i, guild := range guilds {
if i == 10 {
break
}
bf.WriteUint32(guild.ID)
bf.WriteUint32(guild.LeaderCharID)
bf.WriteUint16(guild.MemberCount)