From 81152561622df06ee996aadfb7705688525ed5d2 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 16 Apr 2019 10:05:42 +0800 Subject: [PATCH] Check exec args --- kernel/src/syscall/proc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/src/syscall/proc.rs b/kernel/src/syscall/proc.rs index 2c4b909..c6cc4ec 100644 --- a/kernel/src/syscall/proc.rs +++ b/kernel/src/syscall/proc.rs @@ -146,6 +146,9 @@ pub fn sys_exec( } } info!("exec: args {:?}", args); + if args.is_empty() { + return Err(SysError::EINVAL); + } // Read program file let path = args[0].as_str();