From: Anthony Heading <anthony@ajrh.net>
To: cygwin@cygwin.com
Subject: mkshortcut (cygutils-1.4.14) free error
Date: Sun, 18 Oct 2015 02:30:00 -0000 [thread overview]
Message-ID: <1445135414.3384650.413058409.46BC94AD@webmail.messagingengine.com> (raw)
Seems free() is being called on an adjusted pointer, causing general
misbehaviour. A minimal patch below.
Anthony
--- src/mkshortcut/mkshortcut.c.Orig 2015-10-17 21:57:08.000000000
-0400
+++ src/mkshortcut/mkshortcut.c 2015-10-17 22:16:41.269357400 -0400
@@ -412,7 +412,7 @@
char* exe_name = NULL;
char* dir_name = NULL;
char* desc = NULL;
- char *buf_str, *tmp_str;
+ char *buf_str, *tmp_str, *base_str;
int tmp;
/* For OLE interface */
@@ -489,6 +489,7 @@
{
/* Strip trailing /'s if any */
buf_str = xstrndup (opts.target_arg, strlen(opts.target_arg));
+ base_str = buf_str;
tmp_str = buf_str;
tmp = strlen (buf_str) - 1;
while (strrchr (buf_str, '/') == (buf_str + tmp))
@@ -504,7 +505,7 @@
buf_str++;
}
link_name = xstrndup (tmp_str, strlen (tmp_str));
- free (buf_str);
+ free (base_str);
}
/* User specified a name, so check it and convert */
else
--
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 reply other threads:[~2015-10-18 2:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-18 2:30 Anthony Heading [this message]
2015-10-26 10:01 ` Anthony Heading
2015-10-26 10:08 ` Mark Geisert
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=1445135414.3384650.413058409.46BC94AD@webmail.messagingengine.com \
--to=anthony@ajrh.net \
--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).