ngx_reopen_files() assumes null termination

Andrew Punch apunch at
Tue Mar 11 03:32:52 UTC 2014


I just noticed that ngx_reopen_files() treats the file name as a null
terminated string but there is no guarantee that a ngx_str_t will be null

I noticed in ngx_string.h that the ngx_string() macro sets the length to be
exclusive of the null termination character, however the null termination
would still be present at[s.len]

However ngx_pstrdup() in ngx_string.c only copies the size of s.len - so if
there is a null character at[s.len] it will not be copied.

Could you please help clarify the correct way to handle the strings?



This e-mail and any attachments are confidential and may contain copyright 
material of Brandscreen or third parties. If you are not the intended 
recipient of this email you should not read, print, re-transmit, store or 
act in reliance on this e-mail or any attachments, and should destroy all 
copies of them. Brandscreen does not guarantee the integrity of any emails 
or any attached files. The views or opinions expressed are the author's own 
and may not reflect the views or opinions of Brandscreen.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list