Do some minimal sanity checks on the message data. Avoids trying to allocate

random amounts of memory when getting an invalid header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42770 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2011-09-26 20:32:55 +00:00
parent 2ce1337c71
commit 0d890a6821

View File

@ -9,6 +9,7 @@
#include <new>
#include <AutoDeleter.h>
#include <MessageAdapter.h>
#include <MessagePrivate.h>
#include "Architecture.h"
@ -259,6 +260,10 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (error != B_OK)
return error;
if (fHeader->format != MESSAGE_FORMAT_HAIKU
|| (fHeader->flags & MESSAGE_FLAG_VALID) == 0)
return B_NOT_A_MESSAGE;
if (fIsFlatMessage)
what.SetTo(fHeader->what);
else