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

Refactor strncpy_from_user() #336

Open
JustinStitt opened this issue Aug 8, 2023 · 0 comments
Open

Refactor strncpy_from_user() #336

JustinStitt opened this issue Aug 8, 2023 · 0 comments

Comments

@JustinStitt
Copy link
Collaborator

This runs parallel to #90 in that we want to remove this strncpy call in favor of a less ambiguous and more robust api like strscpy or strtomem.

There is a pathological class of strncpy_from_user() functions which you can see here:

https://elixir.bootlin.com/linux/v6.3/source/arch/um/kernel/skas/uaccess.c#L168

Kees had some insights:

It looks like strncpy_from_user() is a confusingly named string copier for crossing kernel/user memory boundary, but it's named badly because it does not NUL-pad the destination, but it does NOT guarantee NUL-termination. Grrrr.

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

No branches or pull requests

1 participant