mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-14 09:37:34 -05:00
Stop BPPs from handling EOF before reading all data.
The BPP_READ macros in all four BPP implementations (including sshverstring) had the same bug: if EOF had been seen on the network input but there was _also_ enough data in the input queue to satisfy the current request, they would jump straight to complaining about the EOF rather than processing the available data first. I spotted this while trying to pipe in test data from a disk file, but it could easily also lead to us failing to handle the final message in the connection, e.g. losing the error message sent by the remote in a DISCONNECT message.
This commit is contained in:
15
ssh2bpp.c
15
ssh2bpp.c
@ -251,13 +251,14 @@ static void ssh2_bpp_enable_pending_compression(struct ssh2_bpp_state *s)
|
||||
}
|
||||
}
|
||||
|
||||
#define BPP_READ(ptr, len) do \
|
||||
{ \
|
||||
crMaybeWaitUntilV(s->bpp.input_eof || \
|
||||
bufchain_try_fetch_consume( \
|
||||
s->bpp.in_raw, ptr, len)); \
|
||||
if (s->bpp.input_eof) \
|
||||
goto eof; \
|
||||
#define BPP_READ(ptr, len) do \
|
||||
{ \
|
||||
bool success; \
|
||||
crMaybeWaitUntilV((success = bufchain_try_fetch_consume( \
|
||||
s->bpp.in_raw, ptr, len)) || \
|
||||
s->bpp.input_eof); \
|
||||
if (!success) \
|
||||
goto eof; \
|
||||
} while (0)
|
||||
|
||||
#define userauth_range(pkttype) ((unsigned)((pkttype) - 50) < 20)
|
||||
|
Reference in New Issue
Block a user