don't trust filesystem we're calling out to

This change guarantees the vfs stat buffer is initialized. In the event that the fs we're calling in to is lying (says it wrote into buf, but really didn't) uninitialized vfs stack data would get send to the vfs caller.
This commit is contained in:
Ilja van Sprundel 2019-10-11 22:13:58 +02:00 committed by GitHub
parent f7973340e6
commit d51e668f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,6 +239,7 @@ int req_statvfs(endpoint_t fs_e, struct statvfs *buf)
cp_grant_id_t grant_id;
message m;
memset(buf, 0x00, sizeof(struct statvfs));
grant_id = cpf_grant_direct(fs_e, (vir_bytes) buf, sizeof(struct statvfs),
CPF_WRITE);
if(grant_id == GRANT_INVALID)