From 51adc08a1e11fe9e5389e6e7c3e3a4ea4973917b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 2 Oct 2009 12:17:29 +0800 Subject: [PATCH] Added sanity checking to VFS_OPEN --- Kernel/syscalls.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index facc263c..dd1f4b3a 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -122,6 +122,12 @@ void SyscallHandler(tSyscallRegs *Regs) ret = Proc_Execve((char*)Regs->Arg1, (char**)Regs->Arg2, (char**)Regs->Arg3); break; case SYS_LOADBIN: + if( !Syscall_ValidString(Regs->Arg1) + || !Syscall_Valid(sizeof(Uint), Regs->Arg2) ) { + err = -EINVAL; + ret = -1; + break; + } ret = Binary_Load((char*)Regs->Arg1, (Uint*)Regs->Arg2); break; @@ -129,6 +135,11 @@ void SyscallHandler(tSyscallRegs *Regs) // Virtual Filesystem // --- case SYS_OPEN: + if( !Syscall_ValidString(Regs->Arg1) ) { + err = -EINVAL; + ret = -1; + break; + } ret = VFS_Open((char*)Regs->Arg1, Regs->Arg2 | VFS_OPENFLAG_USER); break; -- 2.20.1