mirror of
https://github.com/drasko/codezero.git
synced 2026-01-22 15:53:16 +01:00
Towards user buffer checking
This commit is contained in:
@@ -16,15 +16,28 @@ shmdt
|
||||
mmap
|
||||
munmap
|
||||
read
|
||||
readdir
|
||||
write
|
||||
lseek
|
||||
open
|
||||
close
|
||||
creat
|
||||
mkdir
|
||||
mknod
|
||||
link
|
||||
unlink
|
||||
fork
|
||||
execve
|
||||
getpid
|
||||
wait
|
||||
kill
|
||||
|
||||
Others:
|
||||
pipe
|
||||
mount
|
||||
unmount
|
||||
swapon
|
||||
|
||||
|
||||
New ones will be added as needed.
|
||||
|
||||
|
||||
@@ -412,6 +412,11 @@ int sys_write(l4id_t sender, int fd, void *buf, int count)
|
||||
|
||||
BUG_ON(!(t = find_task(sender)));
|
||||
|
||||
if ((err = check_access(t, buf, count)) < 0) {
|
||||
l4_ipc_return(err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TODO: Check user buffer, count and fd validity */
|
||||
if (fd < 0 || fd > TASK_FILES_MAX) {
|
||||
l4_ipc_return(-EBADF);
|
||||
|
||||
Reference in New Issue
Block a user