Fix all strncpy() usage: need to set a final \0 character at the end
[lttng-tools.git] / ltt-sessiond / ust-ctl.c
index 7c8cc5ebb4084007736c53da9d76d542e6485e58..d9d4af51a1dc16751bdfd5e26c5412280307526e 100644 (file)
@@ -23,7 +23,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "liblttsessiondcomm.h"
+#include <lttng/lttng-sessiond-comm.h>
 #include "lttngerr.h"
 #include "ust-ctl.h"
 
@@ -89,7 +89,8 @@ void get_traces_per_session(struct ltt_session *session, struct lttng_trace *tra
 
        if (session->kern_session_count > 0) {
                trace.type = KERNEL;
-               strncpy(trace.name, "kernel", 6);
+               strncpy(trace.name, "kernel", sizeof(trace.name));
+               trace.name[sizeof(trace.name) - 1] = '\0';
                memcpy(&traces[i], &trace, sizeof(trace));
        }
 }
This page took 0.02316 seconds and 4 git commands to generate.