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.11.0-rc1~521 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8082d471b40e0966275515e11b8594e5e74e5eb0;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); }