summaryrefslogtreecommitdiff
path: root/lib/smb.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-12-31 16:07:32 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-12-31 16:52:12 +0000
commit0df2ed85fd3de5e047166a6142e7bd4a8705d641 (patch)
treec94b2a5be81e0f731161a7b42569d97bba685389 /lib/smb.c
parent5eae12fc804c677bc413a49c7bddaff30d249c9e (diff)
downloadcurl-0df2ed85fd3de5e047166a6142e7bd4a8705d641.tar.gz
smb: Use endian functions for reading length and offset values
Diffstat (limited to 'lib/smb.c')
-rw-r--r--lib/smb.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/smb.c b/lib/smb.c
index 783544405..028695932 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -45,6 +45,7 @@
#include "curl_ntlm_core.h"
#include "curl_memory.h"
#include "escape.h"
+#include "curl_endian.h"
/* The last #include file should be: */
#include "memdebug.h"
@@ -776,10 +777,8 @@ static CURLcode smb_request_state(struct connectdata *conn, bool *done)
next_state = SMB_CLOSE;
break;
}
- len = smb_swap16(*(unsigned short *)((char *)msg +
- sizeof(struct smb_header) + 11));
- off = smb_swap16(*(unsigned short *)((char *)msg +
- sizeof(struct smb_header) + 13));
+ len = Curl_read16_le(((char *) msg) + sizeof(struct smb_header) + 11);
+ off = Curl_read16_le(((char *) msg) + sizeof(struct smb_header) + 13);
if(len > 0) {
result = Curl_client_write(conn, CLIENTWRITE_BODY,
(char *)msg + off + sizeof(unsigned int),
@@ -802,8 +801,7 @@ static CURLcode smb_request_state(struct connectdata *conn, bool *done)
next_state = SMB_CLOSE;
break;
}
- len = smb_swap16(*(unsigned short *)((char *)msg +
- sizeof(struct smb_header) + 5));
+ len = Curl_read16_le(((char *) msg) + sizeof(struct smb_header) + 5);
conn->data->req.bytecount += len;
conn->data->req.offset += len;
Curl_pgrsSetUploadCounter(conn->data, conn->data->req.bytecount);