Be on the safe side when checking the size of data to be written to an area (overflow).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13299 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-06-28 00:35:28 +00:00
parent f8570b7199
commit 047ab3f955
1 changed files with 2 additions and 0 deletions

View File

@ -1064,6 +1064,8 @@ write_user_memory(void *_address, const void *_buffer, int32 size,
}
// restrict this round of writing to the found area
if (toWrite > (int32)areaInfo.size)
toWrite = areaInfo.size;
if (address + toWrite > (char*)areaInfo.address + areaInfo.size)
toWrite = (char*)areaInfo.address + areaInfo.size - address;