printload: fix buffer overflow on NuttX

The NuttX config variable CONFIG_TASK_NAME_SIZE does not include the
null terminator byte, thus the buffer needs to be longer by 1 byte.
This commit is contained in:
Beat Küng
2018-02-14 10:50:14 +01:00
committed by Lorenz Meier
parent 80eca30689
commit 2517d3854c
+2 -2
View File
@@ -175,8 +175,8 @@ void print_load_buffer(uint64_t t, char *buffer, int buffer_length, print_load_c
unsigned tcb_pid = system_load.tasks[i].tcb->pid;
size_t stack_size = system_load.tasks[i].tcb->adj_stack_size;
ssize_t stack_free = 0;
char tcb_name[CONFIG_TASK_NAME_SIZE];
strncpy(tcb_name, system_load.tasks[i].tcb->name, CONFIG_TASK_NAME_SIZE);
char tcb_name[CONFIG_TASK_NAME_SIZE + 1];
strncpy(tcb_name, system_load.tasks[i].tcb->name, CONFIG_TASK_NAME_SIZE + 1);
#if CONFIG_ARCH_INTERRUPTSTACK > 3