X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Fload.c;h=db9bfe0bf18bca0eaf3c6f2277bed6dda2f601d8;hp=e70a87d9228ae994a3da007b859a44ed11039be1;hb=e1b624d005769d1a2e9eb39fee63c73c6395fd76;hpb=2aaf5fc72b69cddad0144166edbdae424153eb82 diff --git a/src/lib/lttng-ctl/load.c b/src/lib/lttng-ctl/load.c index e70a87d92..db9bfe0bf 100644 --- a/src/lib/lttng-ctl/load.c +++ b/src/lib/lttng-ctl/load.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2014 - David Goulet + * Copyright (C) 2014 David Goulet * - * 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 @@ -195,7 +185,12 @@ int lttng_load_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'; } @@ -235,8 +230,12 @@ int lttng_load_session_attr_set_input_url( } /* Copy string plus the NULL terminated byte. */ - lttng_ctl_copy_string(attr->input_url, uris[0].dst.path, + ret = lttng_strncpy(attr->input_url, uris[0].dst.path, sizeof(attr->input_url)); + if (ret) { + ret = -LTTNG_ERR_INVALID; + goto error; + } end: error: