From: Mark Geisert <mark@maxrnd.com>
To: cygwin@cygwin.com
Subject: Re: mkshortcut (cygutils-1.4.14) free error
Date: Mon, 26 Oct 2015 10:08:00 -0000 [thread overview]
Message-ID: <loom.20151026T044455-64@post.gmane.org> (raw)
In-Reply-To: <1445823930.241438.419951441.109BA262@webmail.messagingengine.com>
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.
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2015-10-26 3:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-18 2:30 Anthony Heading
2015-10-26 10:01 ` Anthony Heading
2015-10-26 10:08 ` Mark Geisert [this message]
2015-10-26 10:36 ` Corinna Vinschen
2015-10-27 5:29 ` Anthony Heading
2015-10-26 16:03 ` Ken Brown
2015-10-27 0:11 ` Mark Geisert
2015-10-27 8:46 ` Anthony Heading
2015-10-27 9:30 ` Mark Geisert
2015-10-28 4:49 ` Anthony Heading
2015-10-28 9:15 ` Mark Geisert
2015-10-28 13:05 ` Corinna Vinschen
2015-10-28 14:49 ` Mark Geisert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20151026T044455-64@post.gmane.org \
--to=mark@maxrnd.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).