Test fix: check length of input string
[lttng-tools.git] / tests / unit / ini_config / ini_config.c
index e9710275b39bb56e3b5a162228ffd333207048f7..bf20d1561a616bd24b55f8f062d3c09f1fafc1c5 100644 (file)
@@ -19,6 +19,7 @@
 #include <common/config/session-config.h>
 #include <common/utils.h>
 #include <string.h>
 #include <common/config/session-config.h>
 #include <common/utils.h>
 #include <string.h>
+#include <lttng/constant.h>
 
 struct state {
        int section_1;
 
 struct state {
        int section_1;
@@ -81,6 +82,11 @@ int main(int argc, char **argv)
                goto end;
        }
 
                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")
        path = utils_expand_path(argv[1]);
        if (!path) {
                fail("Failed to resolve sample INI file path")
This page took 0.022893 seconds and 4 git commands to generate.