Welcome! Log In Create A New Profile

Advanced

ngx_reopen_files() assumes null termination

Andrew Punch
March 10, 2014 11:34PM
Hi,

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
terminated.

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.data[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.data[s.len] it will not be copied.

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

-Andrew

--
NOTICE

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.

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

ngx_reopen_files() assumes null termination

Andrew Punch 723 March 10, 2014 11:34PM

Re: ngx_reopen_files() assumes null termination

Maxim Dounin 577 March 11, 2014 08:14AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 190
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready