BSocketMessenger: Fix size mismatch.

- The header size was accidentally being included in the flat buffer size,
  leading to a mismatch error when reading the incoming message.
This commit is contained in:
Rene Gollent 2016-05-01 14:23:58 -04:00
parent 6dd98243c2
commit 6d4e35f60e
1 changed files with 3 additions and 3 deletions

View File

@ -106,9 +106,9 @@ status_t
BSocketMessenger::_SendMessage(const BMessage& message)
{
ssize_t flatSize = message.FlattenedSize();
flatSize += sizeof(ssize_t);
ssize_t totalSize = flatSize + sizeof(ssize_t);
char* buffer = new(std::nothrow) char[flatSize];
char* buffer = new(std::nothrow) char[totalSize];
if (buffer == NULL)
return B_NO_MEMORY;
@ -119,7 +119,7 @@ BSocketMessenger::_SendMessage(const BMessage& message)
if (error != B_OK)
return error;
ssize_t size = fSocket.Write(buffer, flatSize);
ssize_t size = fSocket.Write(buffer, totalSize);
if (size < 0)
return size;