diff options
author | Piotr Sikora <piotr@cloudflare.com> | 2014-06-19 04:16:36 -0700 |
---|---|---|
committer | Piotr Sikora <piotr@cloudflare.com> | 2014-06-19 04:16:36 -0700 |
commit | b3066b16e1d6f7e9c27cc092b67591262d3a8b13 (patch) | |
tree | c5097e0dfbf0bfc81a076b7228bd5654d6c94ffc /src/http/modules/perl/ngx_http_perl_module.c | |
parent | 8f0f4c10e91a82e6f636d792c14cc608c06ca37d (diff) | |
download | nginx-b3066b16e1d6f7e9c27cc092b67591262d3a8b13.tar.gz nginx-b3066b16e1d6f7e9c27cc092b67591262d3a8b13.zip |
Perl: NULL-terminate argument list.
perl_parse() function expects argv/argc-style argument list,
which according to the C standard must be NULL-terminated,
that is: argv[argc] == NULL.
This change fixes a crash (SIGSEGV) that could happen because
of the buffer overrun during perl module initialization.
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Diffstat (limited to 'src/http/modules/perl/ngx_http_perl_module.c')
-rw-r--r-- | src/http/modules/perl/ngx_http_perl_module.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index bf4d1fe9a..6a8894cc3 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -577,7 +577,7 @@ ngx_http_perl_create_interpreter(ngx_conf_t *cf, n = (pmcf->modules != NGX_CONF_UNSET_PTR) ? pmcf->modules->nelts * 2 : 0; - embedding = ngx_palloc(cf->pool, (4 + n) * sizeof(char *)); + embedding = ngx_palloc(cf->pool, (5 + n) * sizeof(char *)); if (embedding == NULL) { goto fail; } @@ -595,6 +595,7 @@ ngx_http_perl_create_interpreter(ngx_conf_t *cf, embedding[n++] = "-Mnginx"; embedding[n++] = "-e"; embedding[n++] = "0"; + embedding[n] = NULL; n = perl_parse(perl, ngx_http_perl_xs_init, n, embedding, NULL); |