Fix: illegal memory access in write_pidfile
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index b8791553670fad96ca8c720a10c0feb1b37f6b63..c5a2ca64e1b6dcc3f4b2c64bc2f0a68a0aaf2b53 100644 (file)
@@ -5061,7 +5061,10 @@ static void write_pidfile(void)
        assert(rundir);
 
        if (opt_pidfile) {
-               strncpy(pidfile_path, opt_pidfile, sizeof(pidfile_path));
+               if (lttng_strncpy(pidfile_path, opt_pidfile, sizeof(pidfile_path))) {
+                       ret = -1;
+                       goto error;
+               }
        } else {
                /* Build pidfile path from rundir and opt_pidfile. */
                ret = snprintf(pidfile_path, sizeof(pidfile_path), "%s/"
This page took 0.040054 seconds and 4 git commands to generate.