Skip to content

Commit

Permalink
Fix a format-security warning when building with clang. (ros2#1064)
Browse files Browse the repository at this point in the history
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 <clalancette@gmail.com>
  • Loading branch information
clalancette authored and Acuadros95 committed Jun 6, 2023
1 parent 5b41c48 commit c75296c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rcl/test/rcl/test_logging_rosout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c75296c

Please sign in to comment.