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 зафіксовано Peter Wu
джерело 4191962f25
коміт de613b152d

@ -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)))