On 06/17/2016 02:24 PM, Marion et Christophe JAILLET wrote:
> Hi,
> 
>  
> 
> The code in trunk and 2.4 don't have the 3 last lines:
> 
>    memcpy(eval->gspend, sz, len + 1);
>    /* hspend will now point to NULL character */
>    eval->gspend += len;
> 
>  
> 
> See:
> 
>    
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/sed1.c?revision=1326984&view=markup#l231
> 
>  
> 
>  
> 
> The code in my first post is what I think is correct.
> 
> Sorry for not being clear.

Sorry for not reading your mail correctly :-). It was in there.
Yes, I agree that the copy stuff is missing. Weird. Nevertheless I think

eval->gspend += len;

in your proposal is wrong as eval->gspend looks like the buffer base pointer
for me that should not be changed.

Regards

Rüdiger

> 
>  
> 
> CJ
> 
>     > Message du 17/06/16 12:00
>     > De : "Ruediger Pluem" <[email protected]>
>     > A : [email protected]
>     > Copie à :
>     > Objet : Re: Question about mod_sed
>     >
>     >
>     >
>     > On 06/16/2016 10:33 PM, Christophe JAILLET wrote:
>     > > Hi,
>     > >
>     > >
>     > > I'm not familiar with sed implementation, but 'copy_to_genbuf' looks 
> spurious.
>     > >
>     > > Actually it only expands a buffer if some space is needed, but 
> nothing is copied.
>     > >
>     > >
>     > > Should it look like:
>     > >
>     > > static void copy_to_genbuf(sed_eval_t *eval, const char* sz)
>     > > {
>     > > int len = strlen(sz);
>     > > unsigned int reqsize = len + 1;
>     > > if (eval->gsize < reqsize) {
>     > > grow_gen_buffer(eval, reqsize, NULL);
>     > > }
>     > > memcpy(eval->gspend, sz, len + 1);
>     >
>     > The above does a copy, or do I miss your point?
>     >
>     > > /* hspend will now point to NULL character */
>     > > eval->gspend += len;
>     > > }
>     >
>     > Regards
>     >
>     > Rüdiger
>     > 
> 

Reply via email to