From: Jérémie Galarneau Date: Tue, 13 Jun 2017 18:50:05 +0000 (-0400) Subject: Fix: test_utils_expand_path passes NULL to sprintf X-Git-Tag: v2.8.7~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=747089c539adb7873c75360c29d340ef6b17bc00;p=lttng-tools.git Fix: test_utils_expand_path passes NULL to sprintf Signed-off-by: Jérémie Galarneau --- diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c index 44173f6f0..9bf81b924 100644 --- a/tests/unit/test_utils_expand_path.c +++ b/tests/unit/test_utils_expand_path.c @@ -312,9 +312,12 @@ static void test_utils_expand_path(void) /* Test invalid cases */ for (i = 0; i < num_invalid_tests; i++) { - sprintf(name, "invalid test case: %s", invalid_tests_inputs[i]); + const char *test_input = invalid_tests_inputs[i]; - result = utils_expand_path(invalid_tests_inputs[i]); + sprintf(name, "invalid test case: %s", test_input ? + test_input : "NULL"); + + result = utils_expand_path(test_input); if (result != NULL) { free(result); }