public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mkshortcut (cygutils-1.4.14)  free error
@ 2015-10-18  2:30 Anthony Heading
  2015-10-26 10:01 ` Anthony Heading
  0 siblings, 1 reply; 13+ messages in thread
From: Anthony Heading @ 2015-10-18  2:30 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-10-28  9:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-18  2:30 mkshortcut (cygutils-1.4.14) free error Anthony Heading
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

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).