Adding bounds checking to buffer copy in Server.stream