From f2f8e65bd333a7cbc5e2d168bb7f5d3485835759 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 20 Apr 2023 10:03:41 -0400 Subject: [PATCH] Fix a format-security warning when building with clang. (#1064) In particular, you should never have a "bare" string in a printf-like call; that could potentially access uninitialized memory. Instead, make sure to format the string with %s. Signed-off-by: Chris Lalancette --- rcl/test/rcl/test_logging_rosout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcl/test/rcl/test_logging_rosout.cpp b/rcl/test/rcl/test_logging_rosout.cpp index dfea8f47b..2aa4bfe57 100644 --- a/rcl/test/rcl/test_logging_rosout.cpp +++ b/rcl/test/rcl/test_logging_rosout.cpp @@ -194,7 +194,7 @@ check_if_rosout_subscription_gets_a_message( size_t iteration = 0; const char * message = "SOMETHING"; do { - RCUTILS_LOG_INFO_NAMED(logger_name, message); + RCUTILS_LOG_INFO_NAMED(logger_name, "%s", message); ++iteration; ret = rcl_wait_set_clear(&wait_set); ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;