Commit 4b7723fe authored by Pontus Freyhult's avatar Pontus Freyhult
Browse files

In sftp_read_packet; when called with unread data, try to read the

remaining data of the current packet before returning 0 (or -1 if we
had an error during reading).

Rev: src/sftp/buffer.c:1.11
parent 62e75f58
......@@ -202,7 +202,25 @@ sftp_read_packet(struct sftp_input *i)
int done;
if (i->left)
return 0;
UINT8 d;
while (i->left && /* Data remaining? */
sftp_get_data(i, 1, &d) /* Read OK? */
/* Now, there shouldn't be any more data remaining. Next time
* we're called, the next packet should be read (or we had an
* error and all data is not read, if that's the case, return
* error).
if (i->left) /* i->left non-zero => sftp_get_data returned zero => error */
return -1;
return 0;
/* First, deallocate the strings. */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment