forked from jshiffer/go-xmpp
Do not copy more bytes than were read
This commit is contained in:
parent
ffadd331dd
commit
38bdcaec36
@ -100,7 +100,7 @@ func (t WebsocketTransport) startReader() {
|
|||||||
if n > 0 {
|
if n > 0 {
|
||||||
// We need to make a copy, otherwise we will overwrite the slice content
|
// We need to make a copy, otherwise we will overwrite the slice content
|
||||||
// on the next iteration of the for loop.
|
// on the next iteration of the for loop.
|
||||||
tmp := make([]byte, len(buffer))
|
tmp := make([]byte, n)
|
||||||
copy(tmp, buffer)
|
copy(tmp, buffer)
|
||||||
t.queue <- tmp
|
t.queue <- tmp
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user