crypto/tls: better error for oversized handshake messages.
This change improves the error message when encountering a TLS handshake message that is larger than our limit (64KB). Previously the error was just “local error: internal error”. Updates #13401. Change-Id: I86127112045ae33e51079e3bc047dd7386ddc71a Reviewed-on: https://go-review.googlesource.com/20547 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Adam Langley <agl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
dae4f046c8
commit
2cd00eea5d
3
conn.go
3
conn.go
@ -803,7 +803,8 @@ func (c *Conn) readHandshake() (interface{}, error) {
|
||||
data := c.hand.Bytes()
|
||||
n := int(data[1])<<16 | int(data[2])<<8 | int(data[3])
|
||||
if n > maxHandshake {
|
||||
return nil, c.in.setErrorLocked(c.sendAlert(alertInternalError))
|
||||
c.sendAlertLocked(alertInternalError)
|
||||
return nil, c.in.setErrorLocked(fmt.Errorf("tls: handshake message of length %d bytes exceeds maximum of %d bytes", n, maxHandshake))
|
||||
}
|
||||
for c.hand.Len() < 4+n {
|
||||
if err := c.in.err; err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user