1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-11 20:15:03 -05:00

smb: Fixed a problem with large file transfers

Fixed an issue with the message size calculation where the raw bytes
from the buffer were interpreted as signed values rather than unsigned
values.

Reported-by: Gisle Vanem
Assisted-by: Bill Nagel
This commit is contained in:
Steve Holme 2014-12-06 21:44:00 +00:00
parent 36d45eabc0
commit befe9a10b9

View File

@ -266,11 +266,11 @@ static CURLcode smb_recv_message(struct connectdata *conn, void **msg)
msg_size = sizeof(struct smb_header); msg_size = sizeof(struct smb_header);
if(nbt_size >= msg_size + 1) { if(nbt_size >= msg_size + 1) {
/* Add the word count */ /* Add the word count */
msg_size += 1 + buf[msg_size] * sizeof(unsigned short); msg_size += 1 + ((unsigned char) buf[msg_size]) * sizeof(unsigned short);
if(nbt_size >= msg_size + sizeof(unsigned short)) { if(nbt_size >= msg_size + sizeof(unsigned short)) {
/* Add the byte count */ /* Add the byte count */
msg_size += sizeof(unsigned short) + buf[msg_size] + msg_size += sizeof(unsigned short) + ((unsigned char) buf[msg_size]) +
(buf[msg_size + 1] << 8); (((unsigned char) buf[msg_size + 1]) << 8);
if(nbt_size < msg_size) if(nbt_size < msg_size)
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }