From dc2889c57e5a3bddd7f0807bceabf4ebad06341a Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 13 Jun 2012 16:23:50 -0400 Subject: [PATCH] [release-branch.go1] crypto/tls: fix decoding of certLen in certificateMsg.unmarshal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ««« backport bcfa9fc88361 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 https://golang.org/cl/6197077 »»» --- src/pkg/crypto/tls/handshake_messages.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pkg/crypto/tls/handshake_messages.go b/src/pkg/crypto/tls/handshake_messages.go index e1517cc794..54c7a3e631 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:] } -- 2.50.0