This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1369a2875dd sched/misc/coredump.c: guard tcb->name in coredump
1369a2875dd is described below

commit 1369a2875dd641084ff1d652571ce0dd3aad94dc
Author: raiden00pl <[email protected]>
AuthorDate: Tue Jun 16 14:21:35 2026 +0200

    sched/misc/coredump.c: guard tcb->name in coredump
    
    coredump_dump_tcb() copied tcb->name unconditionally, but the tcb_s name
    member only exists when CONFIG_TASK_NAME_SIZE > 0
    
    Signed-off-by: raiden00pl <[email protected]>
---
 sched/misc/coredump.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c
index 1cb41ab5df1..cd0ea350be9 100644
--- a/sched/misc/coredump.c
+++ b/sched/misc/coredump.c
@@ -305,11 +305,17 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s 
*cinfo,
 
   elf_emit(cinfo, &nhdr, sizeof(nhdr));
 
+#if CONFIG_TASK_NAME_SIZE > 0
   strlcpy(name, tcb->name, sizeof(name));
+#else
+  name[0] = '\0';
+#endif
   elf_emit(cinfo, name, sizeof(name));
 
   info.pr_pid   = tcb->pid;
+#if CONFIG_TASK_NAME_SIZE > 0
   strlcpy(info.pr_fname, tcb->name, sizeof(info.pr_fname));
+#endif
   elf_emit(cinfo, &info, sizeof(info));
 
   /* Fill Process status */

Reply via email to