From 14a4841772ddc52d9aeebabde1781841a5eb1832 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Mon, 11 Nov 2024 22:13:10 +0000 Subject: [PATCH] Fix bug where size of file name buffer was less than maximum file name size --- src/userprog/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/userprog/process.c b/src/userprog/process.c index c960df9..7e211c4 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -43,7 +43,7 @@ struct process_start_data char *cmd_saveptr; /* Value pointed to by 'saveptr' argument used by successive calls to strtok_r to split 'cmd' into tokens while maintaining state. */ - char file_name[FNAME_MAX_LEN]; /* Name of the file of the process to + char file_name[FNAME_MAX_LEN + 1]; /* Name of the file of the process to be started. */ }; @@ -84,7 +84,7 @@ process_execute (const char *cmd) it running the function 'start_process' with the appropriate arguments. For details of arguments, see 'start_process'. */ data->cmd = cmd_copy; - strlcpy (data->file_name, file_name, FNAME_MAX_LEN); + strlcpy (data->file_name, file_name, FNAME_MAX_LEN + 1); tid = thread_create (file_name, PRI_DEFAULT, start_process, data); if (tid == TID_ERROR)