Skip to content

Conversation

@emasab
Copy link
Contributor

@emasab emasab commented Apr 2, 2025

No description provided.

Copilot AI review requested due to automatic review settings April 2, 2025 17:06
@emasab emasab requested a review from a team as a code owner April 2, 2025 17:06
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a warning about using the same variable for both input and output by refactoring how the debug string is built.

  • Introduces an index variable to track the current position in the output buffer
  • Adds an extra bound check in the while loop to avoid buffer overruns
Comments suppressed due to low confidence (1)

tests/test.c:1108

  • [nitpick] Consider renaming 'i' to a more descriptive name, such as 'current_pos', to improve code readability.
size_t i = rd_snprintf(debug_with_contexts, sizeof(debug_with_contexts), "%s", test_debug ? test_debug : "");

tests/test.c Outdated
test_debug ? test_debug : "");
/* Add all debug contexts and set debug configuration */
while (*debug_contexts) {
while (*debug_contexts && i < sizeof(debug_with_contexts) - 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while (*debug_contexts && i < sizeof(debug_with_contexts) - 2) {
while (strlen(*debug_contexts) + i <= sizeof(debug_with_contexts) - 2) {

@emasab emasab changed the title Fix for a warning about using the variable in input and output [tests] Fix for a warning about using the variable in input and output Apr 3, 2025
@emasab
Copy link
Contributor Author

emasab commented May 29, 2025

Closing as it was merged in #5059

@emasab emasab closed this May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants