Skip to content
Snippets Groups Projects
Commit a438707b authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Don't accept mis-sized message payloads in the cmix send layer

parent b546741a
No related branches found
No related tags found
3 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast
......@@ -62,12 +62,22 @@ func (c *client) Send(recipient *id.ID, fingerprint format.Fingerprint,
"Cannot send cmix message when the network is not healthy")
}
if len(payload) != c.maxMsgLen {
return 0, ephemeral.Id{}, errors.Errorf(
"bad message length (%d, need %d)",
len(payload), c.maxMsgLen)
}
// Build message. Will panic if inputs are not correct.
msg := format.NewMessage(c.session.GetCmixGroup().GetP().ByteLen())
msg.SetKeyFP(fingerprint)
msg.SetContents(payload)
msg.SetMac(mac)
msg.SetKeyFP(fingerprint)
msg.SetSIH(service.Hash(msg.GetContents()))
msg.SetMac(mac)
jww.TRACE.Printf("sendCmix Contents: %v, KeyFP: %v, MAC: %v, SIH: %v",
msg.GetContents(), msg.GetKeyFP(), msg.GetMac(),
msg.GetSIH())
if cmixParams.Critical {
c.crit.AddProcessing(msg, recipient, cmixParams)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment