delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/28/17:47:42

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=lU8NvJ
yluZhi5SNbgEJS4hSEW+w2eHgwIb6YnuBQ3ljW81qvJVVPt4VH8QzNq7691z4c/L
17/RFR0gKIZfDmwXRui+oVv3LsOU7YLmZZ3ZodVJQEE3EF8ZDyQnqGe+PPE0UbDq
HAsEfrKGjq9aVHzIK6B/+gkKbp+WfTQ+vUqsA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=xbd1B4BNBGkZ
j9q0DDRpuBuKxOc=; b=lkjSANDByV0an4Glc0LOkPytP7AG9rO80JHz9FPWpxt9
60L3lBCVnwo3ZplfbrWlj+7ymhP09BEgYgt/o6TFtMrYdZJAiQ6VLLgHb9GY+x1p
qY54OvkrWrZASJsvcCizhBQOdSlmew+xBEy0nuQxvXGHTisTmupnY+JXPVC1E+M=
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
X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=BAYES_50,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,RDNS_NONE autolearn=no version=3.3.1
X-Yahoo-SMTP: u.JgLvyswBBMp9ZJJfsX14qmYb3T2ivhMAr6OupnxLpNQEFZ9g--
X-Rocket-Received: from [192.168.1.72] (jon DOT turney AT 109 DOT 155 DOT 7 DOT 202 with plain) by smtp830.mail.ird.yahoo.com with SMTP; 28 Jul 2013 14:46:46 -0700 PDT
Message-ID: <51F59159.6050005@dronecode.org.uk>
Date: Sun, 28 Jul 2013 22:47:05 +0100
From: Jon TURNEY <jon DOT turney AT dronecode DOT org DOT uk>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: setup-x86_64: postinstall errors: Package bash 1, Package a2ps 2 and xinit 134
References: <CADex0xx+uY6Y8ngZ3tUsYr+KPi0t0+H+H7X-civ-iq0diuJfZw AT mail DOT gmail DOT com> <51EE0951 DOT 90007 AT users DOT sourceforge DOT net> <51EEC7F2 DOT 5000402 AT cwilson DOT fastmail DOT fm> <20130723184615 DOT GK9689 AT calimero DOT vinschen DOT de> <51EED4B4 DOT 7000908 AT cwilson DOT fastmail DOT fm> <20130723192342 DOT GM9689 AT calimero DOT vinschen DOT de> <51EFD0EB DOT 6030804 AT cwilson DOT fastmail DOT fm> <1358868658 DOT 20130724173406 AT mtu-net DOT ru> <CADex0xynZvSvXCZ7TNFoqO-djtijKcNSvibVnYyO4KEwTftirg AT mail DOT gmail DOT com>
In-Reply-To: <CADex0xynZvSvXCZ7TNFoqO-djtijKcNSvibVnYyO4KEwTftirg@mail.gmail.com>
X-Virus-Found: No

--------------060502000701090506050301
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 25/07/2013 05:24, Kenneth Wolcott wrote:
>   I downloaded a fresh setup-x86_64.exe from cygwin.com and then ran
> the update again.
> 
>   Now I get only this postinstall error:
> 
>   Package: xinit
>     xinit.sh exit code 134
I can reproduce this problem, so I had a go at investigating and fixing it.

mkshortcut appears to exiting with SIGABRT in free(), which suggests some heap
corruption, which I managed to track down after a bit of work with dmalloc.

This appears to be a long standing bug, which for some reason manifests itself
more severely on x86_64.

xstrncat() does not allow for the terminating null byte in the memory
allocation it makes.  strncat(dest, src, n) writes n+1 bytes to dest (n from
src plus the terminating null byte, which is always appended).  So, the size
of dest must be at least strlen(dest)+n+1.  Currently only strlen(dest)+n
bytes are allocated.

Trivial patch attached.


--------------060502000701090506050301
Content-Type: text/plain; charset=windows-1252;
 name="cygutils-strncat.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="cygutils-strncat.patch"

--- origsrc/cygutils-1.4.12/src/mkshortcut/mkshortcut.c	2013-04-28 00:17:56.000000000 +0100
+++ src/cygutils-1.4.12/src/mkshortcut/mkshortcut.c	2013-07-28 22:36:54.890625000 +0100
@@ -394,7 +394,7 @@ xstrndup (const char *string, size_t n)
 static char *
 xstrncat (char **dest, const char *add, size_t n)
 {
-  size_t len = strlen (*dest) + n;
+  size_t len = strlen (*dest) + n + 1;
   char *s = (char *) realloc (*dest, len * sizeof (char));
   if (!s)
   {


--------------060502000701090506050301
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


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