X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Fsave.c;h=c8d8ac9c24ed4e2118c4c036047888affd7a3bc1;hb=a0377dfefe40662ba7d68617bce6ff467114136c;hp=555006d0aff1350938c450aea93f481583a6b018;hpb=30f9c3276ad06d4c2e30444ad1ce45e57f9ad708;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/save.c b/src/lib/lttng-ctl/save.c index 555006d0a..c8d8ac9c2 100644 --- a/src/lib/lttng-ctl/save.c +++ b/src/lib/lttng-ctl/save.c @@ -1,22 +1,11 @@ /* - * Copyright (C) 2013 - Jérémie Galarneau + * Copyright (C) 2013 Jérémie Galarneau * - * 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 -#include #include #include @@ -99,7 +88,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'; } @@ -139,8 +133,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: