[PATCH] perl module: fix SSI parameter termination bug

Matthew Daley mattjd at gmail.com
Wed Mar 14 00:34:40 UTC 2012


On Wed, Mar 14, 2012 at 3:16 AM, Alexandr Gomoliako <zzz at zzz.org.ua> wrote:
[...]
>
>>> Correct solution would be to reserve space for NUL character in
>>> ssi module instead.  Quick and dirty patch which should work:
>
>>> --- a/src/http/modules/ngx_http_ssi_filter_module.c
>>> +++ b/src/http/modules/ngx_http_ssi_filter_module.c
>>> @@ -1204,7 +1204,7 @@ ngx_http_ssi_parse(ngx_http_request_t *r
>>>
>>>                 if (ctx->value_buf == NULL) {
>>>                     ctx->param->value.data = ngx_pnalloc(r->pool,
>>> -                                                         ctx->value_len);
>>> +                                                         ctx->value_len +
>>> 1);
>>>                     if (ctx->param->value.data == NULL) {
>>>                         return NGX_ERROR;
>>>                     }
>>>
>>
>> I wasn't sure if changing the SSI allocation code was appropriate in
>> this case, but since newSVpvn really does need the NULL termination,
>> this is indeed a better idea.
>
> No, it's not. The only solution is to fix it in ssi module, as
> proposed by Maxim.
>

I think you misunderstood me there; I was indeed agreeing that
applying the fix in the SSI module is a better idea, not my original
patch.

Thanks for the info on newSVpvn.



More information about the nginx-devel mailing list