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

C library: Change usage of strlen to use strnlen #342

Merged

Conversation

oyvindronningstad
Copy link
Collaborator

Add a maxlen argument to the _term functions.

@sigvartmh
Copy link

Seems for some targets(1 target) it doesn't exist. Maybe check for libc version with this change?

Copy link

@sigvartmh sigvartmh left a comment

Choose a reason for hiding this comment

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

Other than the build error, the code looks sane :) Also, it's a nice safety/security change.

Copy link
Collaborator

@FilipZajdel FilipZajdel left a comment

Choose a reason for hiding this comment

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

Nice improvement :)

Add a maxlen argument to the _term functions.

Signed-off-by: Øyvind Rønningstad <[email protected]>
Some tests needed NEWLIB to get certain features. NEWLIB doesn't work
well when using strnlen, so switch to PICOLIB.

Signed-off-by: Øyvind Rønningstad <[email protected]>
@oyvindronningstad oyvindronningstad merged commit a2d1b14 into NordicSemiconductor:main Jul 26, 2023
16 checks passed
@oyvindronningstad oyvindronningstad deleted the remove-strlen branch July 26, 2023 11:48
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