crypto/tls: disallow handshake messages fragmented across CCS

BoGo: FragmentAcrossChangeCipherSpec-Server-Packed
This commit is contained in:
Filippo Valsorda 2017-01-18 16:53:35 +00:00 committed by Peter Wu
parent 4191962f25
commit de613b152d

View File

@ -776,6 +776,11 @@ func (c *Conn) readRecord(want recordType) error {
c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage))
break break
} }
// Handshake messages are not allowed to fragment across the CCS
if c.hand.Len() > 0 {
c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage))
break
}
err := c.in.changeCipherSpec() err := c.in.changeCipherSpec()
if err != nil { if err != nil {
c.in.setErrorLocked(c.sendAlert(err.(alert))) c.in.setErrorLocked(c.sendAlert(err.(alert)))