From c013a0e8d6bb57247074c748a05bbe7f43bdec6f Mon Sep 17 00:00:00 2001 From: Marco Paland Date: Wed, 16 Jan 2019 10:44:13 +0100 Subject: fix(printf): fctprintf() must not append null terminator Fixes #39, references #19 --- test/test_suite.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_suite.cpp b/test/test_suite.cpp index bcddd4f..100b59f 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -69,7 +69,8 @@ TEST_CASE("fctprintf", "[]" ) { printf_idx = 0U; memset(printf_buffer, 0xCC, 100U); test::fctprintf(&_out_fct, nullptr, "This is a test of %X", 0x12EFU); - REQUIRE(!strcmp(printf_buffer, "This is a test of 12EF")); + REQUIRE(!strncmp(printf_buffer, "This is a test of 12EF", 22U)); + REQUIRE(printf_buffer[22] == (char)0xCC); } -- cgit v1.2.3