mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix insecure user-space pointer dereferences in sys_memstat.
This commit is contained in:
parent
cab62b77d5
commit
08df67eef2
1 changed files with 4 additions and 5 deletions
|
@ -50,11 +50,10 @@ static int sys_memstat(size_t* memused, size_t* memtotal)
|
|||
size_t used;
|
||||
size_t total;
|
||||
Statistics(&used, &total);
|
||||
// TODO: Check if legal user-space buffers!
|
||||
if ( memused )
|
||||
*memused = used;
|
||||
if ( memtotal )
|
||||
*memtotal = total;
|
||||
if ( memused && !CopyToUser(memused, &used, sizeof(used)) )
|
||||
return -1;
|
||||
if ( memtotal && !CopyToUser(memtotal, &total, sizeof(used)) )
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue