aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-01 16:28:33 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-05 14:38:43 +0200
commitaec9fa4442d2d5e0bc79400a084c3e308ed40644 (patch)
treec2152f04d4f387d96b34c54c49ac54e441433dc7
parent85a274ff3c21fafefbdca4cbd95c9b4a076bfdb8 (diff)
downloadlibssh-aec9fa4442d2d5e0bc79400a084c3e308ed40644.tar.gz
libssh-aec9fa4442d2d5e0bc79400a084c3e308ed40644.tar.xz
libssh-aec9fa4442d2d5e0bc79400a084c3e308ed40644.zip
sftp: Use bytearray macros
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/sftp.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/sftp.c b/src/sftp.c
index 9dec687a..6e6b4c67 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -48,6 +48,7 @@
#include "libssh/channels.h"
#include "libssh/session.h"
#include "libssh/misc.h"
+#include "libssh/bytearray.h"
#ifdef WITH_SFTP
@@ -67,19 +68,6 @@ static void sftp_message_free(sftp_message msg);
static void sftp_set_error(sftp_session sftp, int errnum);
static void status_msg_free(sftp_status_message status);
-static uint32_t sftp_get_u32(const void *vp)
-{
- const uint8_t *p = (const uint8_t *)vp;
- uint32_t v;
-
- v = (uint32_t)p[0] << 24;
- v |= (uint32_t)p[1] << 16;
- v |= (uint32_t)p[2] << 8;
- v |= (uint32_t)p[3];
-
- return v;
-}
-
static sftp_ext sftp_ext_new(void) {
sftp_ext ext;
@@ -405,7 +393,7 @@ sftp_packet sftp_packet_read(sftp_session sftp)
}
} while (nread < 4);
- size = sftp_get_u32(buffer);
+ size = PULL_BE_U32(buffer, 0);
if (size == 0 || size > SFTP_PACKET_SIZE_MAX) {
ssh_set_error(sftp->session, SSH_FATAL, "Invalid sftp packet size!");
goto error;