]> git.kaiwu.me - nginx.git/commitdiff
Perl: fixed optimization in SSI command handler.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 1 Nov 2016 17:39:21 +0000 (20:39 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 1 Nov 2016 17:39:21 +0000 (20:39 +0300)
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).

src/http/modules/perl/ngx_http_perl_module.c

index 6a8894cc3b1a559fcb955b6d66f7a56d4603b30f..f9a9a84c05172f633e46bb84544a50981dcb0933 100644 (file)
@@ -410,7 +410,7 @@ ngx_http_perl_ssi(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ssi_ctx,
 
     args = &params[NGX_HTTP_PERL_SSI_ARG];
 
-    if (args) {
+    if (args[0]) {
 
         for (i = 0; args[i]; i++) { /* void */ }