aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2015-01-01 20:48:05 +0000
committerSteve Holme <steve_holme@hotmail.com>2015-01-01 20:48:05 +0000
commita3daf542adb63dbf7632fab0166ec26cb231b1c1 (patch)
treef180243bb31c32fc6d6fbbf3b0df16fb4999efb0
parent4bb5a351b2335704c07e3b860a85612058e21e0e (diff)
smb: Use endian functions for reading NBT and message size values
-rw-r--r--lib/smb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/smb.c b/lib/smb.c
index 3fbbf0ea5..e66427ba3 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -306,8 +306,8 @@ static CURLcode smb_recv_message(struct connectdata *conn, void **msg)
if(smbc->got < sizeof(unsigned int))
return CURLE_OK;
- nbt_size = ntohs(*(unsigned short *)(buf + sizeof(unsigned short))) +
- sizeof(unsigned int);
+ nbt_size = Curl_read16_be((unsigned char *)(buf + sizeof(unsigned short))) +
+ sizeof(unsigned int);
if(smbc->got < nbt_size)
return CURLE_OK;
@@ -317,8 +317,8 @@ static CURLcode smb_recv_message(struct connectdata *conn, void **msg)
msg_size += 1 + ((unsigned char) buf[msg_size]) * sizeof(unsigned short);
if(nbt_size >= msg_size + sizeof(unsigned short)) {
/* Add the byte count */
- msg_size += sizeof(unsigned short) + ((unsigned char) buf[msg_size]) +
- (((size_t) ((unsigned char) buf[msg_size + 1])) << 8);
+ msg_size += sizeof(unsigned short) +
+ Curl_read16_le((unsigned char *)&buf[msg_size]);
if(nbt_size < msg_size)
return CURLE_READ_ERROR;
}