nginxinc / ngx-rust

Rust binding for NGINX
Apache License 2.0
752 stars 62 forks source link

Resize vector holding ip address to correct size #88

Closed jmccl closed 2 months ago

jmccl commented 2 months ago

Trivial change to resize the vector holding the ip address to the correct size. Without this the subsequent call to 'from_utf8' operates on a vector that is too large, resulting in garbage at the end of the string produced.

bavshin-f5 commented 2 months ago

The change is correct, but not sufficient. If you do that, NgxHttpOrigDstCtx::save will attempt to copy IPV4_STRLEN bytes from the addr of length e, going past the end of the buffer.

jmccl commented 2 months ago

Good catch. I've updated the PR.

jmccl commented 2 months ago

Done.

bavshin-f5 commented 2 months ago

Thanks!