From b866fa88cd3b40d82c4f6cbe171d480e764f10c8 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Fri, 8 Nov 2024 15:54:47 +0000 Subject: [PATCH] Refactor process.c to use FNAME_MAX_LEN constant --- src/userprog/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/userprog/process.c b/src/userprog/process.c index 6c8ef2d..7dced36 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -81,12 +81,12 @@ start_process (void *file_name_) char *saveptr; char *arg = strtok_r (file_name_, " ", &saveptr); - char file_name[15]; - strlcpy (file_name, arg, 15); + char file_name[FNAME_MAX_LEN + 1]; + strlcpy (file_name, arg, FNAME_MAX_LEN + 1); /* TODO: Move naming of thread to process_execute, so start tokenizing there. */ - strlcpy (thread_current ()->name, file_name, 15); + strlcpy (thread_current ()->name, file_name, FNAME_MAX_LEN + 1); /* Initialize interrupt frame and load executable. */ memset (&if_, 0, sizeof if_);