Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Maxim Dounin
December 22, 2015 09:48AM
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.

--
Maxim Dounin
http://nginx.org/

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

[PATCH] ngx_pstrdup() and ngx_copy() problems

Sergey Matveychuk 519 December 22, 2015 09:22AM

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Maxim Dounin 223 December 22, 2015 09:48AM

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Maxim Konovalov 230 December 22, 2015 09:52AM

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Sergey Matveychuk 226 December 22, 2015 09:58AM

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Valentin V. Bartenev 231 December 22, 2015 10:10AM

Re: [PATCH] ngx_pstrdup() and ngx_copy() problems

Maxim Dounin 283 December 22, 2015 10:22AM



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

Online Users

Guests: 144
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