Yes, I wrong with ngx_copy.

But I see ngx_string_t data is passed to С functions. Just a first example I've found in ngx_open_file_wrapper():
fd = ngx_open_file(name->data, mode, create, access);

Where ngx_open_file() is a macro for open(2).

22.12.2015 17:47, Maxim Dounin пишет:
Hello!

On Tue, Dec 22, 2015 at 05:21:26PM +0300, Sergey Matveychuk wrote:

Hi.

* It looks like strings are supposed to finish with '\0' char to be
compatible with C strings. So ngx_pstrdup() must allocate and copy len+1,
not just len.

* ngx_copy() returns different values for different preprocessor conditions.

PS. I have no idea how trac.nginx.org works. I tried to fill a ticket, but
it just lost.

Trac works fine, and I've just replied to you in the ticket.
Here is a copy of the response:

No, your assumptions are wrong.  Strings in nginx are not expected
to be null-terminated in general.  The ngx_pstrdup() function is
expected to duplicate the string passed, exactly, and this is what
it currently does.  The change to ngx_copy() is also wrong, you've
missed dst++ in the loop.

Please also see http://nginx.org/en/docs/contributing_changes.html.


_______________________________________________
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to