pwntools-ruby
pwntools-ruby copied to clipboard
Bug: recvuntil
Tube::recvuntil optionally takes a timeout. If provided, it enters a loop like
while @timer.active?
s = recv(1)
return '' if s.empty?
# process s
end
However, that return
bails out of the whole function, not the @timer loop. Should be next if s.empty?
Also affects Timer::recvpred
The original design for the timer / tube things is that we assume that after setting timeout_raw
, recv_raw
would either:
- Return some data in at most
timeout_raw
seconds. - Return empty string if no data is available in
timeout_raw
seconds. - Raise
EOFError
.
So we somewhat assume that recv_raw
is a blocking call.
We should definitely document this better (and fix the outdated document after #87), and maybe also provide a fallback implementation for non-blocking recv_raw
.