Fix: liblttng-ctl: unreported truncations when copying strings
[lttng-tools.git] / src / lib / lttng-ctl / save.c
index 8302226644f89f708394e78f6a51ddf2eba061c2..7afac450d2913d077c3ea23b43e8f712f1843f0e 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
@@ -144,8 +134,12 @@ int lttng_save_session_attr_set_output_url(
        }
 
        /* Copy string plus the NULL terminated byte. */
-       lttng_ctl_copy_string(attr->configuration_url, uris[0].dst.path,
-                       sizeof(attr->configuration_url));
+       ret = lttng_strncpy(attr->configuration_url, uris[0].dst.path,
+                           sizeof(attr->configuration_url));
+       if (ret) {
+               ret = -LTTNG_ERR_INVALID;
+               goto error;
+       }
 
 end:
 error:
This page took 0.023171 seconds and 4 git commands to generate.