Do not copy more bytes than were read

disco_info_form
Wichert Akkerman 5 years ago committed by Mickaël Rémond
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…
Cancel
Save