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

Lw/safer string functions #841

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LukasWoodtli
Copy link
Contributor

Provide safer variants of strnlen and strncpy which check the provided bounds of the char arrays.

@LukasWoodtli LukasWoodtli force-pushed the lw/safer_string_functions branch from 2bc2b38 to 9b53e31 Compare January 4, 2025 19:55
@LukasWoodtli LukasWoodtli force-pushed the lw/safer_string_functions branch 3 times, most recently from 13e8a3d to f9ae166 Compare January 4, 2025 20:39
@LukasWoodtli LukasWoodtli marked this pull request as draft January 4, 2025 21:25
@LukasWoodtli LukasWoodtli force-pushed the lw/safer_string_functions branch 3 times, most recently from 11a2254 to 89c061d Compare January 4, 2025 21:48
@LukasWoodtli LukasWoodtli marked this pull request as ready for review January 4, 2025 22:08
Copy link
Contributor

@rettichschnidi rettichschnidi left a comment

Choose a reason for hiding this comment

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

Some quick, initial feedback. Will do a more thorough review once I can spare some time.

core/utils.c Outdated Show resolved Hide resolved
core/utils.h Outdated Show resolved Hide resolved
core/utils.h Outdated Show resolved Hide resolved
core/utils.h Outdated Show resolved Hide resolved
core/utils.h Outdated Show resolved Hide resolved
@LukasWoodtli LukasWoodtli force-pushed the lw/safer_string_functions branch 2 times, most recently from 7dbfaec to b4304de Compare January 8, 2025 17:06
The function searches for the terminating `NULL` character in the given
string up to a given maximun length.
The function checks for source and destination lengths provided.
@LukasWoodtli LukasWoodtli force-pushed the lw/safer_string_functions branch from b4304de to 8e0b0f7 Compare January 8, 2025 17:14
Copy link

sonarqubecloud bot commented Jan 8, 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.

2 participants