1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

smb: Use endian functions for reading length and offset values

This commit is contained in:
Steve Holme 2014-12-31 16:07:32 +00:00
parent 5eae12fc80
commit 0df2ed85fd

View File

@ -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);