Merge branch 'exec-missing-validation' into 'master'

Add validation to check for missing files in exec() args

See merge request lab2425_autumn/pintos_22!36
This commit is contained in:
Demetriades, Themis
2024-11-11 23:25:26 +00:00

View File

@@ -81,6 +81,10 @@ process_execute (const char *cmd)
of the process. */ of the process. */
char *file_name = strtok_r (cmd_copy, " ", &data->cmd_saveptr); char *file_name = strtok_r (cmd_copy, " ", &data->cmd_saveptr);
/* Validates that the current file to be executed is a valid file */
if (filesys_open (file_name) == NULL)
return TID_ERROR;
/* Create a new thread to execute the command, by initializing /* Create a new thread to execute the command, by initializing
it running the function 'start_process' with the appropriate it running the function 'start_process' with the appropriate
arguments. For details of arguments, see 'start_process'. */ arguments. For details of arguments, see 'start_process'. */