OSDN Git Service

perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul
[android-x86/kernel.git] / tools / perf / ui / tui / helpline.c
index 88f5143..3c97e27 100644 (file)
@@ -23,7 +23,7 @@ static void tui_helpline__push(const char *msg)
        SLsmg_set_color(0);
        SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
        SLsmg_refresh();
-       strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
+       strlcpy(ui_helpline__current, msg, sz);
 }
 
 static int tui_helpline__show(const char *format, va_list ap)