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.10.0-rc2~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=552954561d81b5cc06e6df7326a4e650d44102d4;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 5fc383c62..aa7984b40 100644 --- a/tests/unit/test_utils_expand_path.c +++ b/tests/unit/test_utils_expand_path.c @@ -311,9 +311,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); }