X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Funit%2Fini_config%2Fini_config.c;h=a16d1b9e8d8f540a4e87215e6ab9c2162eebc4d9;hb=674c3e2c8477aafe7b2145861ad83dd041d59018;hp=38fe5f4f2193a7770881ea65b02e5e3b43f87316;hpb=1501a7f32e1abf3e805053d4241c9796882d56bc;p=lttng-tools.git diff --git a/tests/unit/ini_config/ini_config.c b/tests/unit/ini_config/ini_config.c index 38fe5f4f2..a16d1b9e8 100644 --- a/tests/unit/ini_config/ini_config.c +++ b/tests/unit/ini_config/ini_config.c @@ -1,24 +1,15 @@ /* - * Copyright (c) - 2013 Jérémie Galarneau + * Copyright (C) 2013 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by as - * published by the Free Software Foundation; only version 2 of the License. + * SPDX-License-Identifier: GPL-2.0-only * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include -#include +#include #include #include +#include struct state { int section_1; @@ -31,9 +22,9 @@ struct state { int lttng_opt_quiet = 1; int lttng_opt_verbose = 0; +int lttng_opt_mi; -int entry_handler(const struct config_entry *entry, - struct state *state) +static int entry_handler(const struct config_entry *entry, struct state *state) { int ret = 0; @@ -80,6 +71,11 @@ int main(int argc, char **argv) goto end; } + if (strlen(argv[1]) >= LTTNG_PATH_MAX) { + diag("The provided path exceeds the maximal permitted length of %i bytes", + LTTNG_PATH_MAX); + goto end; + } path = utils_expand_path(argv[1]); if (!path) { fail("Failed to resolve sample INI file path")