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

vfs: Buffer names for nul termination #107

Merged
merged 2 commits into from
Aug 21, 2024
Merged

vfs: Buffer names for nul termination #107

merged 2 commits into from
Aug 21, 2024

Conversation

chrysn
Copy link
Member

@chrysn chrysn commented Aug 21, 2024

This fixes a severe bug where file names were passed to the C API that expects nul-termination.

This incurs some copying overhead, which fortunately is not too bad due to the name length limit.

Closes: #93

Thanks @maikerlab for reporting this. AIU it went unnoticed because in my tests, the &str often came from what was originally nul-terminated, eg. from the command line, or from CoAP where the option byte is sometimes replaced with a \0 as a part gcoap's internal processing.

chrysn added 2 commits August 22, 2024 00:38
This fixes a severe bug where file names were passed to the C API that
expects nul-termination.

Closes: #93
@chrysn chrysn enabled auto-merge August 21, 2024 22:57
@chrysn chrysn merged commit f66e278 into main Aug 21, 2024
67 checks passed
@chrysn chrysn deleted the vfs-fixes branch August 21, 2024 23:05
@chrysn
Copy link
Member Author

chrysn commented Aug 23, 2024

As a follow-up, one could provide equivalent functions that pass in a cstr -- that would allow zero-overhead use, but I'm unsure whether people actually have their hands on such strings.

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.

vfs: error when opening files from constfs filesystem
1 participant