mkshortcut (cygutils-1.4.14) free error

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Oct 26 10:36:00 GMT 2015


On Oct 26 03:57, Mark Geisert wrote:
> Anthony Heading writes:
> > I see the cygutils package has been orphaned, perhaps explaining the
> > lack of response to the below.  
> > A related question then is that the vanilla mkshortcut built from the
> > latest source package does not
> > seem to perfectly match the behaviour of the binary.    Is there any way
> > to review or reproduce how
> > the binary package was built, or any other way to verify that the source
> > and binaries do match?
> 
> Unfortunately I have no answers for your good questions above.  But...
> 
> > On Sat, Oct 17, 2015, at 10:30 PM, Anthony Heading wrote:
> > > Seems free() is being called on an adjusted pointer,  causing general
> > > misbehaviour.  A minimal patch below.
> 
> [...sorry for deletions within the patch; trying to satisfy gmane...]
> > > -  char *buf_str, *tmp_str;
> > > +  char *buf_str, *tmp_str, *base_str;
> [...]
> > >        buf_str = xstrndup (opts.target_arg, strlen(opts.target_arg));
> > > +      base_str = buf_str;
> > >        tmp_str = buf_str;
> 
> ...if tmp_str is not modified after the above line, ...
> 
> > >        tmp = strlen (buf_str) - 1;
> > >        while (strrchr (buf_str, '/') == (buf_str + tmp))
> > >  <at>  <at>  -504,7 +505,7  <at>  <at> 
> > >            buf_str++;
> > >          }
> > >        link_name = xstrndup (tmp_str, strlen (tmp_str));
> > > -      free (buf_str);
> > > +      free (base_str);
> 
> ...then "free(tmp_str);" should solve the original issue without having to
> define a new variable base_str.  I didn't look at the complete original
> code, only the patch that you posted, but hopefully this points to a "more
> minimal" fix if you agree it's solid.

Ideally somebody takes a heart and takes over the package as maintainer :}


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20151026/59493b64/attachment.sig>


More information about the Cygwin mailing list