nginxinc / ngx-rust

Rust binding for NGINX
Apache License 2.0
726 stars 58 forks source link

Resize vector holding ip address to correct size #88

Closed jmccl closed 2 weeks ago

jmccl commented 2 weeks 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 weeks 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 weeks ago

Good catch. I've updated the PR.

jmccl commented 2 weeks ago

Done.

bavshin-f5 commented 2 weeks ago

Thanks!