Should be able to spot the reverse overlap.

The memcpy vs memmove difference is pretty simple, and has not
false positived once.

Claudio Jeker <cje...@diehard.n-r-g.com> wrote:

> On Mon, Dec 30, 2019 at 10:31:30AM +0100, Denis Fondras wrote:
> > On Sun, Dec 29, 2019 at 11:56:57PM +0100, Theo Buehler wrote:
> > > > That's a problem on my side, I will sort it and retry.
> > > 
> > > This diff fixes it:
> > > 
> > > Index: libvips/iofuncs/init.c
> > > --- libvips/iofuncs/init.c.orig
> > > +++ libvips/iofuncs/init.c
> > > @@ -858,7 +858,7 @@ extract_prefix( const char *dir, const char *name )
> > >   for( i = 0; i < (int) strlen( vname ); i++ ) 
> > >           if( vips_isprefix( G_DIR_SEPARATOR_S "." G_DIR_SEPARATOR_S, 
> > >                   vname + i ) )
> > > -                 memcpy( vname + i, vname + i + 2, 
> > > +                 memmove( vname + i, vname + i + 2, 
> > >                           strlen( vname + i + 2 ) + 1 );
> > >   if( vips_ispostfix( vname, G_DIR_SEPARATOR_S "." ) )
> > >           vname[strlen( vname ) - 2] = '\0';
> > > 
> > 
> > Thank you Theo.
> > Any idea why sometime it would break and sometime it would work ?
> 
> If strlen( vname + i + 2 ) < 2 then there is no overlap. Not sure if that
> can explain why it works sometimes but fails other times.
> 
> -- 
> :wq Claudio
> 

Reply via email to