diff --git a/prudp_server.go b/prudp_server.go index 762b585..d734323 100644 --- a/prudp_server.go +++ b/prudp_server.go @@ -82,7 +82,8 @@ func (ps *PRUDPServer) listenDatagram(quit chan struct{}) { read, addr, err = ps.udpSocket.ReadFromUDP(buffer) if err == nil { - packetData := buffer[:read] + packetData := make([]byte, read) + copy(packetData, buffer[:read]) err = ps.handleSocketMessage(packetData, addr, nil) }