Fix libelf/libelf_coredump.c:234:7: warning: 'strncpy' output may be truncated copying 16 bytes from a string of length 31

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-21 23:56:59 +08:00 committed by Petro Karashchenko
parent 10f8f6c9e3
commit cd516bd09d
1 changed files with 2 additions and 2 deletions

View File

@ -227,11 +227,11 @@ static void elf_emit_note_info(FAR struct elf_dumpinfo_s *cinfo)
elf_emit(cinfo, &nhdr, sizeof(nhdr));
strncpy(name, tcb->name, sizeof(name));
strlcpy(name, tcb->name, sizeof(name));
elf_emit(cinfo, name, sizeof(name));
info.pr_pid = tcb->pid;
strncpy(info.pr_fname, tcb->name, sizeof(info.pr_fname));
strlcpy(info.pr_fname, tcb->name, sizeof(info.pr_fname));
elf_emit(cinfo, &info, sizeof(info));
/* Fill Process status */