Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: cloud: Use strnlen() for ssafety #119

Merged
merged 1 commit into from
Mar 19, 2025
Merged

Conversation

jtguggedal
Copy link
Contributor

Use strnlen() instead of strlen(). It was safe in this case, but always nice to use strnlen() when possible.
Flagged by Sonarcloud.

Use strnlen() instead of strlen(). It was safe in this case, but
always nice to use strnlen() when possible.
Flagged by Sonarcloud.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🎯 Core Changes: The primary change in this PR is the replacement of strlen() with strnlen() in the test file cloud_module_test.c. This change enhances safety by preventing potential buffer overflows when determining the length of strings. Additionally, a preprocessor directive is added to ensure strnlen() is available when compiling with -std=c99.

⚠️ Concerns: There are no significant concerns with this change as it improves safety without altering the logic or functionality of the tests.

Verdict: Approve. The changes are straightforward, improve safety, and are unlikely to introduce any issues.


Code review performed by OPENAI - gpt-4o.

@jtguggedal jtguggedal merged commit 7e0967b into main Mar 19, 2025
4 checks passed
@jtguggedal jtguggedal deleted the cloud-test-fixes branch March 19, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant