8000 Remove invalid use of `memccpy()` by krader1961 · Pull Request #80 · att/ast · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Remove invalid use of memccpy() #80

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

Merged
merged 1 commit into from
Oct 25, 2017
Merged

Remove invalid use of memccpy() #80

merged 1 commit into from
Oct 25, 2017

Conversation

krader1961
Copy link
Contributor

The behavior of the memccpy() function is undefined when the buffers
overlap which is sometimes true for the sfputr() function. So always
use an explicit loop to copy the data.

Fixes #78

The behavior of the `memccpy()` function is undefined when the buffers
overlap which is sometimes true for the `sfputr()` function. So always
use an explicit loop to copy the data.

Fixes #78
< 93D7 /div>
@krader1961
Copy link
Contributor Author

You might argue that we should still use memccpy() where it is known to handle overlapping buffers (e.g., glibc on x86). But that's dangerous. It would probably never happen but theoretically a future libc release could change the implementation such that overlapping buffers are no longer handled. More importantly, just because glibc on x86 handles this situation that is no guarantee that glibc on another architecture (e.g., ppc) will do so. Thus you can't use a blacklist like the code currently does. You have to use a whitelist. And as I noted in issue #78 the added complexity isn't justified.

@siteshwar siteshwar merged commit ad83a87 into att:beta Oct 25, 2017
@krader1961 krader1961 deleted the memccpy branch November 11, 2017 04:24
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
0