From 8f89d7a07ed82ed441125e7f989551d099eba5f4 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 25 Aug 2014 05:25:52 +1000 Subject: [PATCH] Use CopyExact when extracting handshake read --- client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 0999d6da..a513a0ae 100644 --- a/client.go +++ b/client.go @@ -448,9 +448,9 @@ func handshake(sock io.ReadWriteCloser, ih *InfoHash, peerID [20]byte) (res hand if string(b[:20]) != pp.Protocol { return } - copy(res.peerExtensionBytes[:], b[20:28]) - copy(res.InfoHash[:], b[28:48]) - copy(res.peerID[:], b[48:68]) + CopyExact(&res.peerExtensionBytes, b[20:28]) + CopyExact(&res.InfoHash, b[28:48]) + CopyExact(&res.peerID, b[48:68]) if ih == nil { // We were waiting for the peer to tell us what they wanted. post(res.InfoHash[:]) -- 2.48.1