Skip to content

Commit

Permalink
fix: allocate buffers for incoming packets
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfendale committed Jul 7, 2024
1 parent bd47ff2 commit 0621d95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion prudp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 0621d95

Please sign in to comment.