Skip to content

fix: empty string handling in NgxStr::from_ngx_str #152

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
Apr 17, 2025

Conversation

bavshin-f5
Copy link
Member

A valid empty ngx_str_t is allowed to have an uninitialized data pointer, so calling slice::from_raw_parts() on it is not safe.
Thankfully, we've already solved this in ngx_str_t::as_bytes() and can just use the method.

Fixes #150

@bavshin-f5 bavshin-f5 merged commit b09e48e into nginx:master Apr 17, 2025
10 checks passed
@bavshin-f5 bavshin-f5 deleted the ngx-str-default-150 branch April 17, 2025 23:50
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.

NgxStr Default 问题
2 participants