projects
/
btrtrc.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b01c59
)
Use CopyExact when extracting handshake read
author
Matt Joiner <anacrolix@gmail.com>
Sun, 24 Aug 2014 19:25:52 +0000 (
05:25
+1000)
committer
Matt Joiner <anacrolix@gmail.com>
Sun, 24 Aug 2014 19:25:52 +0000 (
05:25
+1000)
client.go
patch
|
blob
|
history
diff --git
a/client.go
b/client.go
index 0999d6dab46aa1056461a4c2435988069f364152..a513a0aee583df64d4b2c0ae77ff1ae676d8d84f 100644
(file)
--- 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[:])