mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-28 18:42:39 +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:
@@ -16,6 +16,11 @@ func handleMsgMhfSaveRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
// saved every floor on road, holds values such as floors progressed, points etc.
|
||||
// can be safely handled by the client
|
||||
pkt := p.(*mhfpacket.MsgMhfSaveRengokuData)
|
||||
if len(pkt.RawDataPayload) < 91 {
|
||||
s.logger.Warn("Rengoku payload too short", zap.Int("len", len(pkt.RawDataPayload)))
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
dumpSaveData(s, pkt.RawDataPayload, "rengoku")
|
||||
_, err := s.server.db.Exec("UPDATE characters SET rengokudata=$1 WHERE id=$2", pkt.RawDataPayload, s.charID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user