Fix bug where size of file name buffer was less than maximum file name size

This commit is contained in:
Themis Demetriades
2024-11-11 22:13:10 +00:00
parent 52fdd47e0c
commit 14a4841772

View File

@@ -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)