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.9.5~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aa5886f536d2f2f84d3a90b8cef116332f596621;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); }