From c2304e1ed951644bbe559348030bbb2844b348de Mon Sep 17 00:00:00 2001 From: Will Cosgrove Date: Sat, 21 Dec 2019 19:35:22 +0800 Subject: [PATCH] misc.c: _libssh2_ntohu32 cast bit shifting (#401) --- src/misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/misc.c b/src/misc.c index bd084c8..b307260 100644 --- a/src/misc.c +++ b/src/misc.c @@ -196,7 +196,10 @@ _libssh2_send(libssh2_socket_t sock, const void *buffer, size_t length, unsigned int _libssh2_ntohu32(const unsigned char *buf) { - return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + return (((unsigned int)buf[0] << 24) + | ((unsigned int)buf[1] << 16) + | ((unsigned int)buf[2] << 8) + | ((unsigned int)buf[3])); } -- 1.8.3.1