From d2cc4eccc7fb35e14a1cb48665cca3e6fd3e955a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 7 Sep 2018 21:48:49 +0200 Subject: [PATCH] sftp: Get the packet type directly from the buffer Signed-off-by: Andreas Schneider --- src/sftp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sftp.c b/src/sftp.c index a733935b..e882e2e9 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -375,12 +375,11 @@ sftp_packet sftp_packet_read(sftp_session sftp) } } } while (r < 1); - ssh_buffer_add_data(packet->payload, buffer, r); - packet->type = 0; - ssh_buffer_get_u8(packet->payload, &packet->type); + packet->type = buffer[0]; - size--; + /* Remove the packet type size */ + size -= sizeof(uint8_t); r = ssh_buffer_allocate_size(packet->payload, size); if (r < 0) {