socksproto: possible AsyncReadExt misuse
Have a look at this code from socks.rs...
// Read some more stuff.
n_read += socks_r
.read(&mut inbuf[n_read..])
.await
.context("Error while reading SOCKS handshake")?;
Suppose that read()
returns Ok(0), indicating a connection close. If that happens, we won't notice; we'll just add 0 to n_read. Does this lead to an infinite loop?
Found while hitting ctrl-c on an RPC client at just the wrong time.
cc @Diziet