From: John Hodge Date: Fri, 2 Oct 2009 04:17:29 +0000 (+0800) Subject: Added sanity checking to VFS_OPEN X-Git-Tag: rel0.06~395 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=51adc08a1e11fe9e5389e6e7c3e3a4ea4973917b;p=tpg%2Facess2.git Added sanity checking to VFS_OPEN --- 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;