Fix insecure user-space pointer dereferences in sys_memstat.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-01-19 18:09:11 +01:00
parent cab62b77d5
commit 08df67eef2
1 changed files with 4 additions and 5 deletions

View File

@ -50,11 +50,10 @@ static int sys_memstat(size_t* memused, size_t* memtotal)
size_t used; size_t used;
size_t total; size_t total;
Statistics(&used, &total); Statistics(&used, &total);
// TODO: Check if legal user-space buffers! if ( memused && !CopyToUser(memused, &used, sizeof(used)) )
if ( memused ) return -1;
*memused = used; if ( memtotal && !CopyToUser(memtotal, &total, sizeof(used)) )
if ( memtotal ) return -1;
*memtotal = total;
return 0; return 0;
} }