[PATCH] ngx_pstrdup() and ngx_copy() problems
mdounin at mdounin.ru
Tue Dec 22 14:47:41 UTC 2015
On Tue, Dec 22, 2015 at 05:21:26PM +0300, Sergey Matveychuk wrote:
> * 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.
More information about the nginx-devel