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))
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()
if err != nil {
c.in.setErrorLocked(c.sendAlert(err.(alert)))