diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-12-17 12:24:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-12-17 12:24:02 -0600 |
commit | d9cccec2ed5c71a759f6f2b7198554d6e98fd22c (patch) | |
tree | 15ae376a381961d38dc47a348f72d5743075ec40 /nuttx/include | |
parent | 2fa884cbcd0efab5e3f34df978c89415d341a510 (diff) | |
download | px4-nuttx-d9cccec2ed5c71a759f6f2b7198554d6e98fd22c.tar.gz px4-nuttx-d9cccec2ed5c71a759f6f2b7198554d6e98fd22c.tar.bz2 px4-nuttx-d9cccec2ed5c71a759f6f2b7198554d6e98fd22c.zip |
strncpy will not copy the terminating \0 into the destination if the source is larger than the size of the destination. Ensure that the last byte is always zero and let strncpy only copy CONFIG_TASK_NAME_SIZE bytes. The issue of unterminated names can be observed in ps when creating a pthread while CONFIG_TASK_NAME_SIZE is set to 8.
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/sched.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 563773ec1..fa0810711 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -536,7 +536,7 @@ struct tcb_s struct xcptcontext xcp; /* Interrupt register save area */ #if CONFIG_TASK_NAME_SIZE > 0 - char name[CONFIG_TASK_NAME_SIZE]; /* Task name */ + char name[CONFIG_TASK_NAME_SIZE+1]; /* Task name (with NUL terminator) */ #endif }; |