eustas / ngx_brotli

NGINX module for Brotli compression
BSD 2-Clause "Simplified" License
201 stars 19 forks source link

sufficient buffer space? #21

Closed setharnold closed 5 years ago

setharnold commented 6 years ago

https://github.com/eustas/ngx_brotli/blob/28ce18d2c21a7582549d6ffc471cb1891225e64d/src/ngx_http_brotli_static_module.c#L137

Hello, I couldn't quickly find documentation on the ngx_http_map_uri_to_path() api, so please forgive the potentially naive question. Does the code properly verify that there's sufficient space at p to accept these writes?

Thanks

eustas commented 5 years ago

Hello. The last parameter is "reserved" - i.e. how much extra space to allocate. sizeof(".br") is 4 (including \0 terminator), so we request sizeof(".br") - 1 because terminator is not "extra" =)