Fix: illegal memory access in write_pidfile
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index d94dbd7908fb33b35fea1ba9349c2c56d8c43c2e..6081fb2b026818b43c60302d1e9d60a316336300 100644 (file)
@@ -5443,7 +5443,10 @@ static int 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.023158 seconds and 4 git commands to generate.