1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

sftp: Get the packet type directly from the buffer

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-09-07 21:48:49 +02:00
parent 38781f69b0
commit d2cc4eccc7

View File

@@ -375,12 +375,11 @@ sftp_packet sftp_packet_read(sftp_session sftp)
} }
} }
} while (r < 1); } while (r < 1);
ssh_buffer_add_data(packet->payload, buffer, r);
packet->type = 0; packet->type = buffer[0];
ssh_buffer_get_u8(packet->payload, &packet->type);
size--; /* Remove the packet type size */
size -= sizeof(uint8_t);
r = ssh_buffer_allocate_size(packet->payload, size); r = ssh_buffer_allocate_size(packet->payload, size);
if (r < 0) { if (r < 0) {