From: Jérémie Galarneau Date: Fri, 31 Aug 2018 17:47:36 +0000 (-0400) Subject: Test fix: check length of input string X-Git-Tag: v2.11.0-rc1~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1b0bfc2bc022d1e50462b2ef6796c7403067f2d7;p=lttng-tools.git Test fix: check length of input string Reported-by: Coverity Scan (395327 Unbounded source buffer) Signed-off-by: Jérémie Galarneau --- diff --git a/tests/unit/ini_config/ini_config.c b/tests/unit/ini_config/ini_config.c index e9710275b..bf20d1561 100644 --- a/tests/unit/ini_config/ini_config.c +++ b/tests/unit/ini_config/ini_config.c @@ -19,6 +19,7 @@ #include #include #include +#include struct state { int section_1; @@ -81,6 +82,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")