kernel: Initialize allocated KPath buffers to 0.

KPaths are most commonly used in the VFS syscall paths,
and so they are typically user_memcpy'd to/from userland.
In the "to" case this is not really necessary (but it should
be so small of a performance difference as to not matter),
but in the "from" case, we must always clear the buffer
we received from the allocator, so as not to leak information
to userland.

Part of #14961.
This commit is contained in:
Augustin Cavalier 2020-02-09 18:17:01 -05:00
parent 877c1b934f
commit d29d80ebe2

View File

@ -432,6 +432,7 @@ KPath::_AllocateBuffer()
else
#endif
fBuffer = (char*)malloc(fBufferSize);
memset(fBuffer, 0, fBufferSize);
}
if (fBuffer == NULL) {
fFailed = true;