summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gehring <mg@ebfe.org>2012-05-14 12:26:29 -0400
committerMichael Gehring <mg@ebfe.org>2012-05-14 12:26:29 -0400
commit0ed73077556a173c5842d4ec26a8f216e2769c68 (patch)
treea952968d8f9f321ad5ecbf8f31bb7f5a343e822c
parent79f13082fbf67101028eaf94a3c2d16897a26134 (diff)
downloadgo-0ed73077556a173c5842d4ec26a8f216e2769c68.tar.gz
crypto/tls: fix decoding of certLen in certificateMsg.unmarshal
certLen was decoded incorrectly if length > 2^16-1. R=golang-dev, agl CC=golang-dev http://codereview.appspot.com/6197077 Committer: Adam Langley <agl@golang.org>
-rw-r--r--src/pkg/crypto/tls/handshake_messages.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/crypto/tls/handshake_messages.go b/src/pkg/crypto/tls/handshake_messages.go
index e1517cc79..54c7a3e63 100644
--- a/src/pkg/crypto/tls/handshake_messages.go
+++ b/src/pkg/crypto/tls/handshake_messages.go
@@ -563,7 +563,7 @@ func (m *certificateMsg) unmarshal(data []byte) bool {
if len(d) < 4 {
return false
}
- certLen := uint32(d[0])<<24 | uint32(d[1])<<8 | uint32(d[2])
+ certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2])
if uint32(len(d)) < 3+certLen {
return false
}
@@ -575,7 +575,7 @@ func (m *certificateMsg) unmarshal(data []byte) bool {
m.certificates = make([][]byte, numCerts)
d = data[7:]
for i := 0; i < numCerts; i++ {
- certLen := uint32(d[0])<<24 | uint32(d[1])<<8 | uint32(d[2])
+ certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2])
m.certificates[i] = d[3 : 3+certLen]
d = d[3+certLen:]
}