[nginx] Perl: fixed optimization in SSI command handler.

Maxim Dounin mdounin at mdounin.ru
Tue Nov 1 17:39:50 UTC 2016


details:   http://hg.nginx.org/nginx/rev/cb4a4e9bba8e
branches:  
changeset: 6791:cb4a4e9bba8e
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Nov 01 20:39:21 2016 +0300
description:
Perl: fixed optimization in SSI command handler.

As the pointer to the first argument was tested instead of the argument
itself, array of arguments was always created, even if there were no
arguments.  Fix is to test args[0] instead of args.

Found by Coverity (CID 1356862).

diffstat:

 src/http/modules/perl/ngx_http_perl_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -410,7 +410,7 @@ ngx_http_perl_ssi(ngx_http_request_t *r,
 
     args = &params[NGX_HTTP_PERL_SSI_ARG];
 
-    if (args) {
+    if (args[0]) {
 
         for (i = 0; args[i]; i++) { /* void */ }
 



More information about the nginx-devel mailing list