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.

 

CJ

> Message du 17/06/16 12:00
> De : "Ruediger Pluem" 
> A : dev@httpd.apache.org
> 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