summaryrefslogtreecommitdiff
path: root/nuttx/sched/task/task_prctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched/task/task_prctl.c')
-rw-r--r--nuttx/sched/task/task_prctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nuttx/sched/task/task_prctl.c b/nuttx/sched/task/task_prctl.c
index b0e00f316..5bbac6b9f 100644
--- a/nuttx/sched/task/task_prctl.c
+++ b/nuttx/sched/task/task_prctl.c
@@ -133,9 +133,10 @@ int prctl(int option, ...)
if (option == PR_SET_NAME)
{
- /* tcb->name may not be null-terminated */
+ /* Ensure that tcb->name will be null-terminated, truncating if necessary */
strncpy(tcb->name, name, CONFIG_TASK_NAME_SIZE);
+ tcb->name[CONFIG_TASK_NAME_SIZE] = '\0';
}
else
{