Skip to content

Commit 5845930

Browse files
committed
[component][ulog] Fixed the thread name output.
1 parent b2c3389 commit 5845930

File tree

1 file changed

+4
-1
lines changed
  • components/utilities/ulog

1 file changed

+4
-1
lines changed

components/utilities/ulog/ulog.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,10 @@ RT_WEAK rt_size_t ulog_formater(char *log_buf, rt_uint32_t level, const char *ta
315315
/* is not in interrupt context */
316316
if (rt_interrupt_get_nest() == 0)
317317
{
318-
log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->name);
318+
rt_size_t name_len = rt_strnlen(rt_thread_self()->name, RT_NAME_MAX);
319+
320+
rt_strncpy(log_buf + log_len, rt_thread_self()->name, name_len);
321+
log_len += name_len;
319322
}
320323
else
321324
{

0 commit comments

Comments
 (0)