From 38bdcaec3620e10d55556a724c4f89f41f12cfce Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Mon, 21 Oct 2019 10:05:43 +0200 Subject: [PATCH] Do not copy more bytes than were read --- websocket_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websocket_transport.go b/websocket_transport.go index bd8a87b..45b54a4 100644 --- a/websocket_transport.go +++ b/websocket_transport.go @@ -100,7 +100,7 @@ func (t WebsocketTransport) startReader() { if n > 0 { // We need to make a copy, otherwise we will overwrite the slice content // on the next iteration of the for loop. - tmp := make([]byte, len(buffer)) + tmp := make([]byte, n) copy(tmp, buffer) t.queue <- tmp }