1
0
Fork 0
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:
Jonas 'Sortie' Termansen 2014-01-19 18:09:11 +01:00
parent cab62b77d5
commit 08df67eef2

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;
} }