userlandfs: ReadAttr() with user_memcpy()

should fix #14969

Change-Id: Iaf4e1362841b65cb56f112d379db041ef3d8ab08
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2047
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Jérôme Duval 2019-12-22 09:26:08 +01:00
parent 39147a617f
commit d7690f68a8

View File

@ -2882,8 +2882,10 @@ Volume::ReadAttr(void* _node, void* cookie, off_t pos,
|| reply->bytesRead > bufferSize) {
return B_BAD_DATA;
}
if (reply->bytesRead > 0)
memcpy(buffer, readBuffer, reply->bytesRead);
if (reply->bytesRead > 0
&& user_memcpy(buffer, readBuffer, reply->bytesRead) < B_OK) {
return B_BAD_ADDRESS;
}
*bytesRead = reply->bytesRead;
_SendReceiptAck(port);
return error;