Browse Source

note tcp bug

pch/bound_tcp_userland_buffer
Pat Hickey 1 year ago
parent
commit
5c5b7e6e03
  1. 2
      crates/wasi/src/preview2/tcp.rs

2
crates/wasi/src/preview2/tcp.rs

@ -103,7 +103,7 @@ impl HostInputStream for TcpReadStream {
if size == 0 {
return Ok(bytes::Bytes::new());
}
// FIXME: this is an unbounded allocation based on user input. need to bound it.
let mut buf = bytes::BytesMut::with_capacity(size);
let n = match self.stream.try_read_buf(&mut buf) {
// A 0-byte read indicates that the stream has closed.

Loading…
Cancel
Save