delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/09/12/08:48:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <505084BC.8050706@lysator.liu.se>
Date: Wed, 12 Sep 2012 14:49:00 +0200
From: Peter Rosin <peda AT lysator DOT liu DOT se>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: (core dumped) mkshortcut
References: <CAAcBW0xWXFgUvm4bKYW8KtDWSXX5_GbamjQNOjKWLGFoXsfDCg AT mail DOT gmail DOT com> <CA+sc5mmKdBotzCPJTu4-QTpMtKUo4aMZoGPQQLEhOJ7vwEY+9Q AT mail DOT gmail DOT com> <CAAcBW0xJ0gA7tgEWUsFOahPtFPWoOxHPPE1DBKjxoNWf0=3SHA AT mail DOT gmail DOT com> <CA+sc5mn0L_E_WvLmxU0o+3GRb_81vsF1WPPc4N9VBfY4LyyGmQ AT mail DOT gmail DOT com> <7770DC1B-52FD-4A10-81D7-8B31B0425EB6 AT Denis-Excoffier DOT org> <CA+sc5mmWsjFK-4hg=qmEfUg=VPHrmY75+L-8PC3=4OnJJ9zsFw AT mail DOT gmail DOT com> <CA+7conkkOujfd1-hQgDe9TDHLXWMy8jLHs3DpBqcRXxZH6aQTA AT mail DOT gmail DOT com> <504EF556 DOT 3000500 AT gmail DOT com>
In-Reply-To: <504EF556.3000500@gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT MARCOATZERI ~
> $ mkshortcut -n '1234567890123456' '/e/cygwin/e'
> Aborted (core dumped)
> 
> marco AT MARCOATZERI ~
> $ mkshortcut -n '12345678901234567890123456789012' '/e/cygwin/e'
> Aborted (core dumped)
> 
> a longer or shorter name works.
> 
> marco AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019