Welcome! Log In Create A New Profile

Advanced

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

Maxim Dounin
December 22, 2015 10:22AM
Hello!

On Tue, Dec 22, 2015 at 05:57:25PM +0300, Sergey Matveychuk wrote:

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

When a string is expected to be used to call a library function
which accepts null-terminated strings, it's up to the caller to
ensure the string passed is properly null-terminated.

In some cases it happens automatically (e.g., strings from
configuration parser are null-terminated), while in other cases
you'll have to do it explicitly (e.g., in ngx_init_zone_pool()
special format specifier %Z is used to generate a null-terminated
name of a lock file).

--
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 509 December 22, 2015 09:22AM

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

Maxim Dounin 217 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 223 December 22, 2015 09:58AM

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

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

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

Maxim Dounin 277 December 22, 2015 10:22AM



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

Online Users

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