Fix: lttng: uninitialized pointer free'd when no sessiond is present
[lttng-tools.git] / src / lib / lttng-ctl / save.c
index 555006d0aff1350938c450aea93f481583a6b018..90ab941878581160f5a119390221f84f0502b1c0 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #define _LGPL_SOURCE
@@ -99,7 +89,12 @@ int lttng_save_session_attr_set_session_name(
                        goto error;
                }
 
-               strncpy(attr->session_name, session_name, len);
+               ret = lttng_strncpy(attr->session_name, session_name,
+                               sizeof(attr->session_name));
+               if (ret) {
+                       ret = -LTTNG_ERR_INVALID;
+                       goto error;
+               }
        } else {
                attr->session_name[0] = '\0';
        }
This page took 0.024543 seconds and 5 git commands to generate.