comparison src/http/modules/perl/ngx_http_perl_module.c @ 6791:cb4a4e9bba8e

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).
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 01 Nov 2016 20:39:21 +0300
parents 0570e42ffeed
children eada22643e8b
comparison
equal deleted inserted replaced
6790:727c6412673a 6791:cb4a4e9bba8e
408 408
409 sv = newSVpvn((char *) handler->data, handler->len); 409 sv = newSVpvn((char *) handler->data, handler->len);
410 410
411 args = &params[NGX_HTTP_PERL_SSI_ARG]; 411 args = &params[NGX_HTTP_PERL_SSI_ARG];
412 412
413 if (args) { 413 if (args[0]) {
414 414
415 for (i = 0; args[i]; i++) { /* void */ } 415 for (i = 0; args[i]; i++) { /* void */ }
416 416
417 asv = ngx_pcalloc(r->pool, (i + 1) * sizeof(SV *)); 417 asv = ngx_pcalloc(r->pool, (i + 1) * sizeof(SV *));
418 418