(core dumped) mkshortcut

Peter Rosin peda@lysator.liu.se
Wed Sep 12 13:02:00 GMT 2012


On 2012-09-11 10:24, marco atzeri wrote:
> On 9/11/2012 9:59 AM, Pawel Jasinski wrote:
>> hi,
>>
>>>>>>>> mkshortcut -n "I for cygwin bin" /D/cyghome/bin
>>>>>>>> /home/RobertMarkBram/bin/createWindowsShortcut.sh: line 160:  8128
>>>>>>>> Aborted                 (core dumped) mkshortcut -n "$shortcutName"
>>>>>>>> "$target"
>>>>>>>
>>
>>
>> I confirm that, there is something fishy here.
>>
>> this one is from XP
>>
>> REJAP at rzuem5008 ~
>> $ mkshortcut -n "Ifor cygwin bin" /c/cygwin/bin
>>
>> REJAP at rzuem5008 ~
>> $ mkshortcut -n "I for cygwin bin" /c/cygwin/bin
>> Aborted (core dumped)
>>
>>
>> and this one out of Win7 32
>>
>> rejap at win7dev ~
>> $ mkshortcut -n "I for cygwin bin" /c/cygwin/bin
>> Aborted (core dumped)
>>
>> rejap at win7dev ~
>> $ mkshortcut -n "Ifor cygwin bin" /c/cygwin/bin
>>
>>
>> What is interesting, both links lnk file exist and are identical.
>>
>>
>> Cheers,
>> Pawel
>>
> 
> Pawel,
> your cases are the same. I had same result on W7 64
> It seems depending on shortcut length, when multiple of 16:
> 
> marco@MARCOATZERI ~
> $ mkshortcut -n '1234567890123456' '/e/cygwin/e'
> Aborted (core dumped)
> 
> marco@MARCOATZERI ~
> $ mkshortcut -n '12345678901234567890123456789012' '/e/cygwin/e'
> Aborted (core dumped)
> 
> a longer or shorter name works.
> 
> marco@MARCOATZERI ~
> $ mkshortcut -n '123456789012345678901234567890123' '/e/cygwin/e'


Here's a patch that fixes the bug.

Cheers,
Peter

--- src/mkshortcut/mkshortcut.c.orig	2012-04-13 05:12:18.000000000 +0200
+++ src/mkshortcut/mkshortcut.c	2012-09-12 14:46:02.962381900 +0200
@@ -395,7 +395,7 @@
 xstrncat (char **dest, const char *add, size_t n)
 {
   size_t len = strlen (*dest) + n;
-  char *s = (char *) realloc (*dest, len * sizeof (char));
+  char *s = (char *) realloc (*dest, len * sizeof (char) + 1);
   if (!s)
   {
     fprintf (stderr, "%s: out of memory\n", program_name);


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



More information about the Cygwin mailing list