aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/crypto
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2014-04-15 19:40:00 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2014-04-15 19:40:00 -0700
commit853c99ddb8dc25ca361f1efdd65a9b371cc39fcb (patch)
tree2131ac7a9455de31d45c3ac4731b9228e6559a49 /src/pkg/crypto
parentc47f08657a09aaabda3974b50b8a29e460f9927a (diff)
downloadgo-853c99ddb8dc25ca361f1efdd65a9b371cc39fcb.tar.xz
crypto/tls: don't block on Read of zero bytes
Fixes #7775 LGTM=rsc R=agl, rsc CC=golang-codereviews https://golang.org/cl/88340043
Diffstat (limited to 'src/pkg/crypto')
-rw-r--r--src/pkg/crypto/tls/conn.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/crypto/tls/conn.go b/src/pkg/crypto/tls/conn.go
index 000b23cbca..550bc7f8fe 100644
--- a/src/pkg/crypto/tls/conn.go
+++ b/src/pkg/crypto/tls/conn.go
@@ -884,6 +884,11 @@ func (c *Conn) Read(b []byte) (n int, err error) {
if err = c.Handshake(); err != nil {
return
}
+ if len(b) == 0 {
+ // Put this after Handshake, in case people were calling
+ // Read(nil) for the side effect of the Handshake.
+ return
+ }
c.in.Lock()
defer c.in.Unlock()