mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
fix(channelserver): validate client binary blobs before saving
- Reject BinaryType outside 1-5 in SetUserBinary to prevent dynamic column name with unchecked client input - Check rengoku payload length before DB write and fixed-offset reads to prevent panic on short payloads - Require MercData >= 4 bytes before ReadUint32 to prevent panic Ref: Mezeporta/Erupe#158
This commit is contained in:
@@ -13,6 +13,10 @@ func handleMsgSysDeleteUser(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysSetUserBinary)
|
||||
if pkt.BinaryType < 1 || pkt.BinaryType > 5 {
|
||||
s.logger.Warn("Invalid BinaryType", zap.Uint8("type", pkt.BinaryType))
|
||||
return
|
||||
}
|
||||
s.server.userBinaryPartsLock.Lock()
|
||||
s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload
|
||||
s.server.userBinaryPartsLock.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user