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

strncpy_P doesn't zero out memory #2633

Closed
chschu opened this issue Oct 24, 2016 · 0 comments
Closed

strncpy_P doesn't zero out memory #2633

chschu opened this issue Oct 24, 2016 · 0 comments

Comments

@chschu
Copy link
Contributor

chschu commented Oct 24, 2016

Core Version: 2.3.0

According to the C standard, strncpy(dst, src, count) always writes exactly count bytes to dst, padding with zeroes after src has been copied.

The current implementation of strncpy_P doesn't do that, it just stops after copying src and the terminating zero. Code relying on the trailing zeroes works well with strncpy, but it doesn't work with strncpy_P.

@igrr igrr added this to the 2.4.0 milestone May 6, 2017
igrr added a commit that referenced this issue Oct 12, 2017
strncpy should write 'size' characters, padding with zeroes if src is
shorter than 'size'.
d-a-v pushed a commit to d-a-v/Arduino that referenced this issue Oct 15, 2017
strncpy should write 'size' characters, padding with zeroes if src is
shorter than 'size'.
@igrr igrr closed this as completed Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants