Skip to content

Commit ab6ba99

Browse files
davidbenagl
authored andcommitted
crypto/tls: Fix c.in.decrypt error handling.
readRecord was not returning early if c.in.decrypt failed and ran through the rest of the function. It does set c.in.err, so the various checks in the callers do ultimately notice before acting on the result, but we should avoid running the rest of the function at all. Also rename 'err' to 'alertValue' since it isn't actually an error. Change-Id: I6660924716a85af704bd3fe81521b34766238695 Reviewed-on: https://go-review.googlesource.com/24709 Run-TryBot: Adam Langley <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Adam Langley <[email protected]>
1 parent 0166161 commit ab6ba99

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/crypto/tls/conn.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,10 @@ Again:
632632

633633
// Process message.
634634
b, c.rawInput = c.in.splitBlock(b, recordHeaderLen+n)
635-
ok, off, err := c.in.decrypt(b)
635+
ok, off, alertValue := c.in.decrypt(b)
636636
if !ok {
637-
c.in.setErrorLocked(c.sendAlert(err))
637+
c.in.freeBlock(b)
638+
return c.in.setErrorLocked(c.sendAlert(alertValue))
638639
}
639640
b.off = off
640641
data := b.data[b.off:]

0 commit comments

Comments
 (0)