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 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue